Commit 91739838 authored by Ricardo Ribalda's avatar Ricardo Ribalda Committed by Mauro Carvalho Chehab

[media] usb/uvc: Support for V4L2_CTRL_WHICH_DEF_VAL

This driver does not use the control infrastructure.
Add support for the new field which on structure
 v4l2_ext_controls
Signed-off-by: default avatarRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 953eae5d
...@@ -983,6 +983,22 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, ...@@ -983,6 +983,22 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh,
unsigned int i; unsigned int i;
int ret; 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); ret = uvc_ctrl_begin(chain);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1010,6 +1026,10 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle, ...@@ -1010,6 +1026,10 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle,
unsigned int i; unsigned int i;
int ret; int ret;
/* Default value cannot be changed */
if (ctrls->which == V4L2_CTRL_WHICH_DEF_VAL)
return -EINVAL;
ret = uvc_ctrl_begin(chain); ret = uvc_ctrl_begin(chain);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment