summaryrefslogtreecommitdiff
path: root/drivers/media/video/uvc/uvc_v4l2.c
diff options
context:
space:
mode:
authorMartin Rubli <martin_rubli@logitech.com>2010-10-02 19:10:16 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 09:30:26 -0300
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)
cmd == UVCIOC_CTRL_MAP_OLD);
case UVCIOC_CTRL_GET:
- return uvc_xu_ctrl_query(chain, arg, 0);
-
case UVCIOC_CTRL_SET:
- return uvc_xu_ctrl_query(chain, arg, 1);
+ {
+ struct uvc_xu_control *xctrl = arg;
+ struct uvc_xu_control_query xqry = {
+ .unit = xctrl->unit,
+ .selector = xctrl->selector,
+ .query = cmd == UVCIOC_CTRL_GET
+ ? UVC_GET_CUR : UVC_SET_CUR,
+ .size = xctrl->size,
+ .data = xctrl->data,
+ };
+
+ return uvc_xu_ctrl_query(chain, &xqry);
+ }
+
+ case UVCIOC_CTRL_QUERY:
+ return uvc_xu_ctrl_query(chain, arg);
default:
uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", cmd);