* [RFC v4 04/19] media/usb/uvc: Implement vivioc_g_def_ext_ctrls
@ 2015-07-16 8:56 Ricardo Ribalda Delgado
2015-07-17 7:21 ` Laurent Pinchart
0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-07-16 8:56 UTC (permalink / raw)
To: Hans Verkuil, Sakari Ailus, Laurent Pinchart,
Mauro Carvalho Chehab, Guennadi Liakhovetski, linux-media
Cc: Ricardo Ribalda Delgado
Callback needed by ioctl VIDIOC_G_DEF_EXT_CTRLS as this driver does not
use the controller framework.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
Changelog
v4: Comments by Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Remove unneeded uvc_ctrl_begin()
drivers/media/usb/uvc/uvc_v4l2.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 2764f43607c1..7ec7d45b24ed 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -1001,6 +1001,31 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh,
return uvc_ctrl_rollback(handle);
}
+static int uvc_ioctl_g_def_ext_ctrls(struct file *file, void *fh,
+ struct v4l2_ext_controls *ctrls)
+{
+ struct uvc_fh *handle = fh;
+ struct uvc_video_chain *chain = handle->chain;
+ struct v4l2_ext_control *ctrl = ctrls->controls;
+ unsigned int i;
+ int ret;
+ struct v4l2_queryctrl qc;
+
+ for (i = 0; i < ctrls->count; ++ctrl, ++i) {
+ 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;
+ }
+
+ ctrls->error_idx = 0;
+
+ return 0;
+}
+
static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle,
struct v4l2_ext_controls *ctrls,
bool commit)
@@ -1500,6 +1525,7 @@ const struct v4l2_ioctl_ops uvc_ioctl_ops = {
.vidioc_g_ctrl = uvc_ioctl_g_ctrl,
.vidioc_s_ctrl = uvc_ioctl_s_ctrl,
.vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls,
+ .vidioc_g_def_ext_ctrls = uvc_ioctl_g_def_ext_ctrls,
.vidioc_s_ext_ctrls = uvc_ioctl_s_ext_ctrls,
.vidioc_try_ext_ctrls = uvc_ioctl_try_ext_ctrls,
.vidioc_querymenu = uvc_ioctl_querymenu,
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC v4 04/19] media/usb/uvc: Implement vivioc_g_def_ext_ctrls
2015-07-16 8:56 [RFC v4 04/19] media/usb/uvc: Implement vivioc_g_def_ext_ctrls Ricardo Ribalda Delgado
@ 2015-07-17 7:21 ` Laurent Pinchart
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2015-07-17 7:21 UTC (permalink / raw)
To: Ricardo Ribalda Delgado, Mauro Carvalho Chehab
Cc: Hans Verkuil, Sakari Ailus, Guennadi Liakhovetski, linux-media
Hi Ricardo,
Thank you for the patch.
On Thursday 16 July 2015 10:56:43 Ricardo Ribalda Delgado wrote:
> Callback needed by ioctl VIDIOC_G_DEF_EXT_CTRLS as this driver does not
> use the controller framework.
>
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
However, I share Sakari's opinion that he has just voiced in a reply to patch
02/19.
> ---
> Changelog
>
> v4: Comments by Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Remove unneeded uvc_ctrl_begin()
>
>
> drivers/media/usb/uvc/uvc_v4l2.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c
> b/drivers/media/usb/uvc/uvc_v4l2.c index 2764f43607c1..7ec7d45b24ed 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -1001,6 +1001,31 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file,
> void *fh, return uvc_ctrl_rollback(handle);
> }
>
> +static int uvc_ioctl_g_def_ext_ctrls(struct file *file, void *fh,
> + struct v4l2_ext_controls *ctrls)
> +{
> + struct uvc_fh *handle = fh;
> + struct uvc_video_chain *chain = handle->chain;
> + struct v4l2_ext_control *ctrl = ctrls->controls;
> + unsigned int i;
> + int ret;
> + struct v4l2_queryctrl qc;
> +
> + for (i = 0; i < ctrls->count; ++ctrl, ++i) {
> + 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;
> + }
> +
> + ctrls->error_idx = 0;
> +
> + return 0;
> +}
> +
> static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle,
> struct v4l2_ext_controls *ctrls,
> bool commit)
> @@ -1500,6 +1525,7 @@ const struct v4l2_ioctl_ops uvc_ioctl_ops = {
> .vidioc_g_ctrl = uvc_ioctl_g_ctrl,
> .vidioc_s_ctrl = uvc_ioctl_s_ctrl,
> .vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls,
> + .vidioc_g_def_ext_ctrls = uvc_ioctl_g_def_ext_ctrls,
> .vidioc_s_ext_ctrls = uvc_ioctl_s_ext_ctrls,
> .vidioc_try_ext_ctrls = uvc_ioctl_try_ext_ctrls,
> .vidioc_querymenu = uvc_ioctl_querymenu,
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-17 7:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-16 8:56 [RFC v4 04/19] media/usb/uvc: Implement vivioc_g_def_ext_ctrls Ricardo Ribalda Delgado
2015-07-17 7:21 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox