aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2015-03-14 13:04:00 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-10 09:29:27 -0400
commite183201b9e917daf2530b637b2f34f1d5afb934d (patch)
tree1916da510b1ad9517645f0a1bf60d60efa7cba63 /drivers/media
parent1461fe7ab6e61c4ad59f54e308872c0bae09d609 (diff)
[media] uvcvideo: add support for VIDIOC_QUERY_EXT_CTRL
Add support for the new VIDIOC_QUERY_EXT_CTRL ioctl. Since uvc doesn't use the control framework, support for this ioctl isn't automatic. This is makes v4l2-compliance happy as well. [Added blank lines for improved readability] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/usb/uvc/uvc_v4l2.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 927d579e574a..c4b1ac6750d8 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -882,6 +882,35 @@ static int uvc_ioctl_queryctrl(struct file *file, void *fh,
882 return uvc_query_v4l2_ctrl(chain, qc); 882 return uvc_query_v4l2_ctrl(chain, qc);
883} 883}
884 884
885static int uvc_ioctl_query_ext_ctrl(struct file *file, void *fh,
886 struct v4l2_query_ext_ctrl *qec)
887{
888 struct uvc_fh *handle = fh;
889 struct uvc_video_chain *chain = handle->chain;
890 struct v4l2_queryctrl qc = { qec->id };
891 int ret;
892
893 ret = uvc_query_v4l2_ctrl(chain, &qc);
894 if (ret)
895 return ret;
896
897 qec->id = qc.id;
898 qec->type = qc.type;
899 strlcpy(qec->name, qc.name, sizeof(qec->name));
900 qec->minimum = qc.minimum;
901 qec->maximum = qc.maximum;
902 qec->step = qc.step;
903 qec->default_value = qc.default_value;
904 qec->flags = qc.flags;
905 qec->elem_size = 4;
906 qec->elems = 1;
907 qec->nr_of_dims = 0;
908 memset(qec->dims, 0, sizeof(qec->dims));
909 memset(qec->reserved, 0, sizeof(qec->reserved));
910
911 return 0;
912}
913
885static int uvc_ioctl_g_ctrl(struct file *file, void *fh, 914static int uvc_ioctl_g_ctrl(struct file *file, void *fh,
886 struct v4l2_control *ctrl) 915 struct v4l2_control *ctrl)
887{ 916{
@@ -1457,6 +1486,7 @@ const struct v4l2_ioctl_ops uvc_ioctl_ops = {
1457 .vidioc_g_input = uvc_ioctl_g_input, 1486 .vidioc_g_input = uvc_ioctl_g_input,
1458 .vidioc_s_input = uvc_ioctl_s_input, 1487 .vidioc_s_input = uvc_ioctl_s_input,
1459 .vidioc_queryctrl = uvc_ioctl_queryctrl, 1488 .vidioc_queryctrl = uvc_ioctl_queryctrl,
1489 .vidioc_query_ext_ctrl = uvc_ioctl_query_ext_ctrl,
1460 .vidioc_g_ctrl = uvc_ioctl_g_ctrl, 1490 .vidioc_g_ctrl = uvc_ioctl_g_ctrl,
1461 .vidioc_s_ctrl = uvc_ioctl_s_ctrl, 1491 .vidioc_s_ctrl = uvc_ioctl_s_ctrl,
1462 .vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls, 1492 .vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls,