* [PATCH 0/3] Fix uvcvideo revert leftovers
@ 2013-01-11 13:13 Laurent Pinchart
2013-01-11 13:13 ` [PATCH 1/3] uvcvideo: Return -EACCES when trying to access a read/write-only control Laurent Pinchart
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Laurent Pinchart @ 2013-01-11 13:13 UTC (permalink / raw)
To: linux-media; +Cc: Hans Verkuil
Hi Mauro,
Those three patches, for v3.8, fix leftovers of commit
ba68c8530a263dc4de440fa10bb20a1c5b9d4ff5 (Partly revert "[media] uvcvideo: Set
error_idx properly for extended controls API failures").
Hans, if you have time, could you please have a look at the patches from a
compliance point of view ? The G_EXT_CTRLS error_idx issue isn't fixed yet,
I'll send a patch for v3.9.
Laurent Pinchart (3):
uvcvideo: Return -EACCES when trying to access a read/write-only
control
uvcvideo: Cleanup leftovers of partial revert
uvcvideo: Set error_idx properly for S_EXT_CTRLS failures
drivers/media/usb/uvc/uvc_ctrl.c | 4 +++-
drivers/media/usb/uvc/uvc_v4l2.c | 6 ++----
2 files changed, 5 insertions(+), 5 deletions(-)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] uvcvideo: Return -EACCES when trying to access a read/write-only control
2013-01-11 13:13 [PATCH 0/3] Fix uvcvideo revert leftovers Laurent Pinchart
@ 2013-01-11 13:13 ` Laurent Pinchart
2013-01-11 13:21 ` Hans Verkuil
2013-01-11 13:13 ` [PATCH 2/3] uvcvideo: Cleanup leftovers of partial revert Laurent Pinchart
2013-01-11 13:14 ` [PATCH 3/3] uvcvideo: Set error_idx properly for S_EXT_CTRLS failures Laurent Pinchart
2 siblings, 1 reply; 9+ messages in thread
From: Laurent Pinchart @ 2013-01-11 13:13 UTC (permalink / raw)
To: linux-media; +Cc: Hans Verkuil
Commit ba68c8530a263dc4de440fa10bb20a1c5b9d4ff5 (Partly revert "[media]
uvcvideo: Set error_idx properly for extended controls API failures")
also reverted commit 30ecb936cbcd83e3735625ac63e1b4466546f5fe
("uvcvideo: Return -EACCES when trying to access a read/write-only
control") by mistake. Fix it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/usb/uvc/uvc_ctrl.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 2bb7613..d5baab1 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1431,8 +1431,10 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
int ret;
ctrl = uvc_find_control(chain, xctrl->id, &mapping);
- if (ctrl == NULL || (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR) == 0)
+ if (ctrl == NULL)
return -EINVAL;
+ if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR))
+ return -EACCES;
/* Clamp out of range values. */
switch (mapping->v4l2_type) {
--
1.7.8.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] uvcvideo: Cleanup leftovers of partial revert
2013-01-11 13:13 [PATCH 0/3] Fix uvcvideo revert leftovers Laurent Pinchart
2013-01-11 13:13 ` [PATCH 1/3] uvcvideo: Return -EACCES when trying to access a read/write-only control Laurent Pinchart
@ 2013-01-11 13:13 ` Laurent Pinchart
2013-01-11 13:22 ` Hans Verkuil
2013-01-11 13:14 ` [PATCH 3/3] uvcvideo: Set error_idx properly for S_EXT_CTRLS failures Laurent Pinchart
2 siblings, 1 reply; 9+ messages in thread
From: Laurent Pinchart @ 2013-01-11 13:13 UTC (permalink / raw)
To: linux-media; +Cc: Hans Verkuil
Commit ba68c8530a263dc4de440fa10bb20a1c5b9d4ff5 (Partly revert "[media]
uvcvideo: Set error_idx properly for extended controls API failures")
missed two modifications. Clean them up.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/usb/uvc/uvc_v4l2.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index f2ee8c6..5eb8989 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -657,8 +657,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
ret = uvc_ctrl_get(chain, ctrl);
if (ret < 0) {
uvc_ctrl_rollback(handle);
- ctrls->error_idx = ret == -ENOENT
- ? ctrls->count : i;
+ ctrls->error_idx = i;
return ret;
}
}
@@ -686,9 +685,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
ret = uvc_ctrl_set(chain, ctrl);
if (ret < 0) {
uvc_ctrl_rollback(handle);
- ctrls->error_idx = (ret == -ENOENT &&
- cmd == VIDIOC_S_EXT_CTRLS)
- ? ctrls->count : i;
+ ctrls->error_idx = i;
return ret;
}
}
--
1.7.8.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] uvcvideo: Set error_idx properly for S_EXT_CTRLS failures
2013-01-11 13:13 [PATCH 0/3] Fix uvcvideo revert leftovers Laurent Pinchart
2013-01-11 13:13 ` [PATCH 1/3] uvcvideo: Return -EACCES when trying to access a read/write-only control Laurent Pinchart
2013-01-11 13:13 ` [PATCH 2/3] uvcvideo: Cleanup leftovers of partial revert Laurent Pinchart
@ 2013-01-11 13:14 ` Laurent Pinchart
2013-01-11 13:27 ` Hans Verkuil
2 siblings, 1 reply; 9+ messages in thread
From: Laurent Pinchart @ 2013-01-11 13:14 UTC (permalink / raw)
To: linux-media; +Cc: Hans Verkuil
The uvc_set_ctrl() calls don't write to the hardware. A failure at that
point thus leaves the device in a clean state, with no control modified.
Set the error_idx field to the count value to reflect that, as per the
V4L2 specification.
TRY_EXT_CTRLS is unchanged and the error_idx field must always be set to
the failed control index in that case.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/usb/uvc/uvc_v4l2.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 5eb8989..68d59b5 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -685,7 +685,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
ret = uvc_ctrl_set(chain, ctrl);
if (ret < 0) {
uvc_ctrl_rollback(handle);
- ctrls->error_idx = i;
+ ctrls->error_idx = cmd == VIDIOC_S_EXT_CTRLS
+ ? ctrls->count : i;
return ret;
}
}
--
1.7.8.6
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] uvcvideo: Return -EACCES when trying to access a read/write-only control
2013-01-11 13:13 ` [PATCH 1/3] uvcvideo: Return -EACCES when trying to access a read/write-only control Laurent Pinchart
@ 2013-01-11 13:21 ` Hans Verkuil
2013-01-11 13:26 ` Hans Verkuil
0 siblings, 1 reply; 9+ messages in thread
From: Hans Verkuil @ 2013-01-11 13:21 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media
On Fri January 11 2013 14:13:58 Laurent Pinchart wrote:
> Commit ba68c8530a263dc4de440fa10bb20a1c5b9d4ff5 (Partly revert "[media]
> uvcvideo: Set error_idx properly for extended controls API failures")
> also reverted commit 30ecb936cbcd83e3735625ac63e1b4466546f5fe
> ("uvcvideo: Return -EACCES when trying to access a read/write-only
> control") by mistake. Fix it.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
> drivers/media/usb/uvc/uvc_ctrl.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index 2bb7613..d5baab1 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -1431,8 +1431,10 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
> int ret;
>
> ctrl = uvc_find_control(chain, xctrl->id, &mapping);
> - if (ctrl == NULL || (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR) == 0)
> + if (ctrl == NULL)
> return -EINVAL;
> + if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR))
> + return -EACCES;
>
> /* Clamp out of range values. */
> switch (mapping->v4l2_type) {
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] uvcvideo: Cleanup leftovers of partial revert
2013-01-11 13:13 ` [PATCH 2/3] uvcvideo: Cleanup leftovers of partial revert Laurent Pinchart
@ 2013-01-11 13:22 ` Hans Verkuil
0 siblings, 0 replies; 9+ messages in thread
From: Hans Verkuil @ 2013-01-11 13:22 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media
On Fri January 11 2013 14:13:59 Laurent Pinchart wrote:
> Commit ba68c8530a263dc4de440fa10bb20a1c5b9d4ff5 (Partly revert "[media]
> uvcvideo: Set error_idx properly for extended controls API failures")
> missed two modifications. Clean them up.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
> drivers/media/usb/uvc/uvc_v4l2.c | 7 ++-----
> 1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
> index f2ee8c6..5eb8989 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -657,8 +657,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
> ret = uvc_ctrl_get(chain, ctrl);
> if (ret < 0) {
> uvc_ctrl_rollback(handle);
> - ctrls->error_idx = ret == -ENOENT
> - ? ctrls->count : i;
> + ctrls->error_idx = i;
> return ret;
> }
> }
> @@ -686,9 +685,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
> ret = uvc_ctrl_set(chain, ctrl);
> if (ret < 0) {
> uvc_ctrl_rollback(handle);
> - ctrls->error_idx = (ret == -ENOENT &&
> - cmd == VIDIOC_S_EXT_CTRLS)
> - ? ctrls->count : i;
> + ctrls->error_idx = i;
> return ret;
> }
> }
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] uvcvideo: Return -EACCES when trying to access a read/write-only control
2013-01-11 13:21 ` Hans Verkuil
@ 2013-01-11 13:26 ` Hans Verkuil
2013-01-11 13:31 ` Laurent Pinchart
0 siblings, 1 reply; 9+ messages in thread
From: Hans Verkuil @ 2013-01-11 13:26 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media
On Fri January 11 2013 14:21:40 Hans Verkuil wrote:
> On Fri January 11 2013 14:13:58 Laurent Pinchart wrote:
> > Commit ba68c8530a263dc4de440fa10bb20a1c5b9d4ff5 (Partly revert "[media]
> > uvcvideo: Set error_idx properly for extended controls API failures")
> > also reverted commit 30ecb936cbcd83e3735625ac63e1b4466546f5fe
> > ("uvcvideo: Return -EACCES when trying to access a read/write-only
> > control") by mistake. Fix it.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Actually, I need a clarification first: the code only checks for access to
a read-only control, but the patch title says: "Return -EACCES when trying
to access a read/write-only control", so either there is something missing
in the patch, or the patch title is wrong.
I suspect it is just the title that is wrong.
Regards,
Hans
>
> > ---
> > drivers/media/usb/uvc/uvc_ctrl.c | 4 +++-
> > 1 files changed, 3 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> > index 2bb7613..d5baab1 100644
> > --- a/drivers/media/usb/uvc/uvc_ctrl.c
> > +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> > @@ -1431,8 +1431,10 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
> > int ret;
> >
> > ctrl = uvc_find_control(chain, xctrl->id, &mapping);
> > - if (ctrl == NULL || (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR) == 0)
> > + if (ctrl == NULL)
> > return -EINVAL;
> > + if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR))
> > + return -EACCES;
> >
> > /* Clamp out of range values. */
> > switch (mapping->v4l2_type) {
> >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] uvcvideo: Set error_idx properly for S_EXT_CTRLS failures
2013-01-11 13:14 ` [PATCH 3/3] uvcvideo: Set error_idx properly for S_EXT_CTRLS failures Laurent Pinchart
@ 2013-01-11 13:27 ` Hans Verkuil
0 siblings, 0 replies; 9+ messages in thread
From: Hans Verkuil @ 2013-01-11 13:27 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media
On Fri January 11 2013 14:14:00 Laurent Pinchart wrote:
> The uvc_set_ctrl() calls don't write to the hardware. A failure at that
> point thus leaves the device in a clean state, with no control modified.
> Set the error_idx field to the count value to reflect that, as per the
> V4L2 specification.
>
> TRY_EXT_CTRLS is unchanged and the error_idx field must always be set to
> the failed control index in that case.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Regards,
Hans
> ---
> drivers/media/usb/uvc/uvc_v4l2.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
> index 5eb8989..68d59b5 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -685,7 +685,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
> ret = uvc_ctrl_set(chain, ctrl);
> if (ret < 0) {
> uvc_ctrl_rollback(handle);
> - ctrls->error_idx = i;
> + ctrls->error_idx = cmd == VIDIOC_S_EXT_CTRLS
> + ? ctrls->count : i;
> return ret;
> }
> }
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] uvcvideo: Return -EACCES when trying to access a read/write-only control
2013-01-11 13:26 ` Hans Verkuil
@ 2013-01-11 13:31 ` Laurent Pinchart
0 siblings, 0 replies; 9+ messages in thread
From: Laurent Pinchart @ 2013-01-11 13:31 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media
Hi Hans,
On Friday 11 January 2013 14:26:28 Hans Verkuil wrote:
> On Fri January 11 2013 14:21:40 Hans Verkuil wrote:
> > On Fri January 11 2013 14:13:58 Laurent Pinchart wrote:
> > > Commit ba68c8530a263dc4de440fa10bb20a1c5b9d4ff5 (Partly revert "[media]
> > > uvcvideo: Set error_idx properly for extended controls API failures")
> > > also reverted commit 30ecb936cbcd83e3735625ac63e1b4466546f5fe
> > > ("uvcvideo: Return -EACCES when trying to access a read/write-only
> > > control") by mistake. Fix it.
> > >
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >
> > Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
>
> Actually, I need a clarification first: the code only checks for access to
> a read-only control, but the patch title says: "Return -EACCES when trying
> to access a read/write-only control", so either there is something missing
> in the patch, or the patch title is wrong.
>
> I suspect it is just the title that is wrong.
Yes, the title is wrong. The original commit handled both, and
ba68c8530a263dc4de440fa10bb20a1c5b9d4ff5 reverted only half of it.
I'll send a v2 with a fixed title.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-01-11 13:29 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 13:13 [PATCH 0/3] Fix uvcvideo revert leftovers Laurent Pinchart
2013-01-11 13:13 ` [PATCH 1/3] uvcvideo: Return -EACCES when trying to access a read/write-only control Laurent Pinchart
2013-01-11 13:21 ` Hans Verkuil
2013-01-11 13:26 ` Hans Verkuil
2013-01-11 13:31 ` Laurent Pinchart
2013-01-11 13:13 ` [PATCH 2/3] uvcvideo: Cleanup leftovers of partial revert Laurent Pinchart
2013-01-11 13:22 ` Hans Verkuil
2013-01-11 13:14 ` [PATCH 3/3] uvcvideo: Set error_idx properly for S_EXT_CTRLS failures Laurent Pinchart
2013-01-11 13:27 ` Hans Verkuil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).