* [PATCH] uvcvideo: add support for VIDIOC_QUERY_EXT_CTRL
@ 2015-03-14 17:04 Hans Verkuil
2015-04-04 21:34 ` Laurent Pinchart
0 siblings, 1 reply; 2+ messages in thread
From: Hans Verkuil @ 2015-03-14 17:04 UTC (permalink / raw)
To: Linux Media Mailing List, Laurent Pinchart
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.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
drivers/media/usb/uvc/uvc_v4l2.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 43e953f..100e5c1 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -882,6 +882,33 @@ static int uvc_ioctl_queryctrl(struct file *file, void *fh,
return uvc_query_v4l2_ctrl(chain, qc);
}
+static int uvc_ioctl_query_ext_ctrl(struct file *file, void *fh,
+ struct v4l2_query_ext_ctrl *qec)
+{
+ struct uvc_fh *handle = fh;
+ struct uvc_video_chain *chain = handle->chain;
+ struct v4l2_queryctrl qc = { qec->id };
+ int ret;
+
+ ret = uvc_query_v4l2_ctrl(chain, &qc);
+ if (ret)
+ return ret;
+ qec->id = qc.id;
+ qec->type = qc.type;
+ strlcpy(qec->name, qc.name, sizeof(qec->name));
+ qec->minimum = qc.minimum;
+ qec->maximum = qc.maximum;
+ qec->step = qc.step;
+ qec->default_value = qc.default_value;
+ qec->flags = qc.flags;
+ qec->elem_size = 4;
+ qec->elems = 1;
+ qec->nr_of_dims = 0;
+ memset(qec->dims, 0, sizeof(qec->dims));
+ memset(qec->reserved, 0, sizeof(qec->reserved));
+ return 0;
+}
+
static int uvc_ioctl_g_ctrl(struct file *file, void *fh,
struct v4l2_control *ctrl)
{
@@ -1443,6 +1470,7 @@ const struct v4l2_ioctl_ops uvc_ioctl_ops = {
.vidioc_g_input = uvc_ioctl_g_input,
.vidioc_s_input = uvc_ioctl_s_input,
.vidioc_queryctrl = uvc_ioctl_queryctrl,
+ .vidioc_query_ext_ctrl = uvc_ioctl_query_ext_ctrl,
.vidioc_g_ctrl = uvc_ioctl_g_ctrl,
.vidioc_s_ctrl = uvc_ioctl_s_ctrl,
.vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls,
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] uvcvideo: add support for VIDIOC_QUERY_EXT_CTRL
2015-03-14 17:04 [PATCH] uvcvideo: add support for VIDIOC_QUERY_EXT_CTRL Hans Verkuil
@ 2015-04-04 21:34 ` Laurent Pinchart
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2015-04-04 21:34 UTC (permalink / raw)
To: Hans Verkuil; +Cc: Linux Media Mailing List
Hi Hans,
Thank you for the patch.
On Saturday 14 March 2015 18:04:00 Hans Verkuil wrote:
> 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.
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
and applied to my tree with a blank line inserted (I like it when the code has
room to breathe ;-)).
> ---
> drivers/media/usb/uvc/uvc_v4l2.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c
> b/drivers/media/usb/uvc/uvc_v4l2.c index 43e953f..100e5c1 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -882,6 +882,33 @@ static int uvc_ioctl_queryctrl(struct file *file, void
> *fh, return uvc_query_v4l2_ctrl(chain, qc);
> }
>
> +static int uvc_ioctl_query_ext_ctrl(struct file *file, void *fh,
> + struct v4l2_query_ext_ctrl *qec)
> +{
> + struct uvc_fh *handle = fh;
> + struct uvc_video_chain *chain = handle->chain;
> + struct v4l2_queryctrl qc = { qec->id };
> + int ret;
> +
> + ret = uvc_query_v4l2_ctrl(chain, &qc);
> + if (ret)
> + return ret;
> + qec->id = qc.id;
> + qec->type = qc.type;
> + strlcpy(qec->name, qc.name, sizeof(qec->name));
> + qec->minimum = qc.minimum;
> + qec->maximum = qc.maximum;
> + qec->step = qc.step;
> + qec->default_value = qc.default_value;
> + qec->flags = qc.flags;
> + qec->elem_size = 4;
> + qec->elems = 1;
> + qec->nr_of_dims = 0;
> + memset(qec->dims, 0, sizeof(qec->dims));
> + memset(qec->reserved, 0, sizeof(qec->reserved));
> + return 0;
> +}
> +
> static int uvc_ioctl_g_ctrl(struct file *file, void *fh,
> struct v4l2_control *ctrl)
> {
> @@ -1443,6 +1470,7 @@ const struct v4l2_ioctl_ops uvc_ioctl_ops = {
> .vidioc_g_input = uvc_ioctl_g_input,
> .vidioc_s_input = uvc_ioctl_s_input,
> .vidioc_queryctrl = uvc_ioctl_queryctrl,
> + .vidioc_query_ext_ctrl = uvc_ioctl_query_ext_ctrl,
> .vidioc_g_ctrl = uvc_ioctl_g_ctrl,
> .vidioc_s_ctrl = uvc_ioctl_s_ctrl,
> .vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls,
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-04 21:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-14 17:04 [PATCH] uvcvideo: add support for VIDIOC_QUERY_EXT_CTRL Hans Verkuil
2015-04-04 21:34 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox