aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/uvc/uvc_v4l2.c
diff options
context:
space:
mode:
authorMartin Rubli <martin_rubli@logitech.com>2010-10-02 18:10:16 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 08:30:26 -0400
commitfe78d187fe792fac5d190b19a2806c23df28891e (patch)
treedafe6b4217b6a731b8f107df9694c2dcc58071fe /drivers/media/video/uvc/uvc_v4l2.c
parent837d50b5648347b1a011f42e474eeb5f671cc259 (diff)
[media] uvcvideo: Add UVCIOC_CTRL_QUERY ioctl
This ioctl extends UVCIOC_CTRL_GET/SET by not only allowing to get/set XU controls but to also send arbitrary UVC commands to XU controls, namely GET_CUR, SET_CUR, GET_MIN, GET_MAX, GET_RES, GET_LEN, GET_INFO and GET_DEF. This is required for applications to work with XU controls, so that they can properly query the size and allocate the necessary buffers. Signed-off-by: Martin Rubli <martin_rubli@logitech.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/uvc/uvc_v4l2.c')
-rw-r--r--drivers/media/video/uvc/uvc_v4l2.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
index 9005a8d9d5f8..74323362c8e6 100644
--- a/drivers/media/video/uvc/uvc_v4l2.c
+++ b/drivers/media/video/uvc/uvc_v4l2.c
@@ -1029,10 +1029,23 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1029 cmd == UVCIOC_CTRL_MAP_OLD); 1029 cmd == UVCIOC_CTRL_MAP_OLD);
1030 1030
1031 case UVCIOC_CTRL_GET: 1031 case UVCIOC_CTRL_GET:
1032 return uvc_xu_ctrl_query(chain, arg, 0);
1033
1034 case UVCIOC_CTRL_SET: 1032 case UVCIOC_CTRL_SET:
1035 return uvc_xu_ctrl_query(chain, arg, 1); 1033 {
1034 struct uvc_xu_control *xctrl = arg;
1035 struct uvc_xu_control_query xqry = {
1036 .unit = xctrl->unit,
1037 .selector = xctrl->selector,
1038 .query = cmd == UVCIOC_CTRL_GET
1039 ? UVC_GET_CUR : UVC_SET_CUR,
1040 .size = xctrl->size,
1041 .data = xctrl->data,
1042 };
1043
1044 return uvc_xu_ctrl_query(chain, &xqry);
1045 }
1046
1047 case UVCIOC_CTRL_QUERY:
1048 return uvc_xu_ctrl_query(chain, arg);
1036 1049
1037 default: 1050 default:
1038 uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", cmd); 1051 uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", cmd);