[media] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL
authorRicardo Ribalda <ricardo.ribalda@gmail.com>
Thu, 29 Oct 2015 10:10:30 +0000 (08:10 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 17 Nov 2015 16:46:21 +0000 (14:46 -0200)
This driver does not use the control infrastructure.
Add support for the new field which on structure
 v4l2_ext_controls

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/usb/uvc/uvc_v4l2.c

index 2764f43607c146a454a4bcbd89e6d5edc472acfc..d7723ce772b3af6b43804a4996656f9b7b58bc34 100644 (file)
@@ -983,6 +983,22 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh,
        unsigned int i;
        int ret;
 
+       if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL) {
+               for (i = 0; i < ctrls->count; ++ctrl, ++i) {
+                       struct v4l2_queryctrl qc = { .id = ctrl->id };
+
+                       ret = uvc_query_v4l2_ctrl(chain, &qc);
+                       if (ret < 0) {
+                               ctrls->error_idx = i;
+                               return ret;
+                       }
+
+                       ctrl->value = qc.default_value;
+               }
+
+               return 0;
+       }
+
        ret = uvc_ctrl_begin(chain);
        if (ret < 0)
                return ret;
@@ -1010,6 +1026,10 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle,
        unsigned int i;
        int ret;
 
+       /* Default value cannot be changed */
+       if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL)
+               return -EINVAL;
+
        ret = uvc_ctrl_begin(chain);
        if (ret < 0)
                return ret;
This page took 0.026193 seconds and 5 git commands to generate.