Re: [PATCH v2 3/6] media: uvcvideo: Return -EIO for control errors

2021-03-11 Thread Hans Verkuil
On 11/03/2021 23:19, Ricardo Ribalda wrote:
> The device is doing something unspected with the control. Either because
> the protocol is not properly implemented or there has been a HW error.
> 
> Fixes v4l2-compliance:
> 
> Control ioctls (Input 0):
> fail: v4l2-test-controls.cpp(448): s_ctrl returned an error 
> (22)
> test VIDIOC_G/S_CTRL: FAIL
> fail: v4l2-test-controls.cpp(698): s_ext_ctrls returned an 
> error (22)
> test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
> 
> Signed-off-by: Ricardo Ribalda 

Reviewed-by: Hans Verkuil 

Thanks!

Hans

> ---
>  drivers/media/usb/uvc/uvc_video.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/usb/uvc/uvc_video.c 
> b/drivers/media/usb/uvc/uvc_video.c
> index f2f565281e63..25fd8aa23529 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -112,6 +112,11 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 
> unit,
>   case 5: /* Invalid unit */
>   case 6: /* Invalid control */
>   case 7: /* Invalid Request */
> + /*
> +  * The firmware has not properly implemented
> +  * the control or there has been a HW error.
> +  */
> + return -EIO;
>   case 8: /* Invalid value within range */
>   return -EINVAL;
>   default: /* reserved or unknown */
> 



Re: [PATCH v2 3/6] media: uvcvideo: Return -EIO for control errors

2021-03-11 Thread Ricardo Ribalda Delgado
Hi Laurent

On Fri, Mar 12, 2021 at 12:30 AM Laurent Pinchart
 wrote:
>
> Hi Ricardo,
>
> On Thu, Mar 11, 2021 at 11:59:27PM +0100, Ricardo Ribalda Delgado wrote:
> > On Thu, Mar 11, 2021 at 11:53 PM Laurent Pinchart wrote:
> > > On Thu, Mar 11, 2021 at 11:19:43PM +0100, Ricardo Ribalda wrote:
> > > > The device is doing something unspected with the control. Either because
> > > > the protocol is not properly implemented or there has been a HW error.
> > > >
> > > > Fixes v4l2-compliance:
> > > >
> > > > Control ioctls (Input 0):
> > > > fail: v4l2-test-controls.cpp(448): s_ctrl returned an 
> > > > error (22)
> > > > test VIDIOC_G/S_CTRL: FAIL
> > > > fail: v4l2-test-controls.cpp(698): s_ext_ctrls returned 
> > > > an error (22)
> > > > test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
> > > >
> > > > Signed-off-by: Ricardo Ribalda 
> > >
> > > The change looks good to me.
> > >
> > > Reviewed-by: Laurent Pinchart 
> > >
> > > Which of the error codes below do you get with your camera, and for
> > > which control ?
> >
> > Bus 001 Device 003: ID 05c8:03a2 Cheng Uei Precision Industry Co., Ltd
> > (Foxlink) XiaoMi USB 2.0 Webcam
> >
> > info: checking extended control 'White Balance Temperature' (0x0098091a)
> > Control error 7
> > info: checking extended control 'Exposure (Absolute)' (0x009a0902)
> > Control error 6
>
> :-S And what's the request (GET_CUR, GET_INFO, ...) ?

Failed to query (SET_CUR) UVC control 10 on unit 2: -32 (exp. 2).
Failed to query (SET_CUR) UVC control 4 on unit 1: -32 (exp. 4)
>
> > > > ---
> > > >  drivers/media/usb/uvc/uvc_video.c | 5 +
> > > >  1 file changed, 5 insertions(+)
> > > >
> > > > diff --git a/drivers/media/usb/uvc/uvc_video.c 
> > > > b/drivers/media/usb/uvc/uvc_video.c
> > > > index f2f565281e63..25fd8aa23529 100644
> > > > --- a/drivers/media/usb/uvc/uvc_video.c
> > > > +++ b/drivers/media/usb/uvc/uvc_video.c
> > > > @@ -112,6 +112,11 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 
> > > > query, u8 unit,
> > > >   case 5: /* Invalid unit */
> > > >   case 6: /* Invalid control */
> > > >   case 7: /* Invalid Request */
> > > > + /*
> > > > +  * The firmware has not properly implemented
> > > > +  * the control or there has been a HW error.
> > > > +  */
> > > > + return -EIO;
> > > >   case 8: /* Invalid value within range */
> > > >   return -EINVAL;
> > > >   default: /* reserved or unknown */
>
> --
> Regards,
>
> Laurent Pinchart



-- 
Ricardo Ribalda


Re: [PATCH v2 3/6] media: uvcvideo: Return -EIO for control errors

2021-03-11 Thread Laurent Pinchart
Hi Ricardo,

On Thu, Mar 11, 2021 at 11:59:27PM +0100, Ricardo Ribalda Delgado wrote:
> On Thu, Mar 11, 2021 at 11:53 PM Laurent Pinchart wrote:
> > On Thu, Mar 11, 2021 at 11:19:43PM +0100, Ricardo Ribalda wrote:
> > > The device is doing something unspected with the control. Either because
> > > the protocol is not properly implemented or there has been a HW error.
> > >
> > > Fixes v4l2-compliance:
> > >
> > > Control ioctls (Input 0):
> > > fail: v4l2-test-controls.cpp(448): s_ctrl returned an 
> > > error (22)
> > > test VIDIOC_G/S_CTRL: FAIL
> > > fail: v4l2-test-controls.cpp(698): s_ext_ctrls returned 
> > > an error (22)
> > > test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
> > >
> > > Signed-off-by: Ricardo Ribalda 
> >
> > The change looks good to me.
> >
> > Reviewed-by: Laurent Pinchart 
> >
> > Which of the error codes below do you get with your camera, and for
> > which control ?
> 
> Bus 001 Device 003: ID 05c8:03a2 Cheng Uei Precision Industry Co., Ltd
> (Foxlink) XiaoMi USB 2.0 Webcam
> 
> info: checking extended control 'White Balance Temperature' (0x0098091a)
> Control error 7
> info: checking extended control 'Exposure (Absolute)' (0x009a0902)
> Control error 6

:-S And what's the request (GET_CUR, GET_INFO, ...) ?

> > > ---
> > >  drivers/media/usb/uvc/uvc_video.c | 5 +
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/drivers/media/usb/uvc/uvc_video.c 
> > > b/drivers/media/usb/uvc/uvc_video.c
> > > index f2f565281e63..25fd8aa23529 100644
> > > --- a/drivers/media/usb/uvc/uvc_video.c
> > > +++ b/drivers/media/usb/uvc/uvc_video.c
> > > @@ -112,6 +112,11 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, 
> > > u8 unit,
> > >   case 5: /* Invalid unit */
> > >   case 6: /* Invalid control */
> > >   case 7: /* Invalid Request */
> > > + /*
> > > +  * The firmware has not properly implemented
> > > +  * the control or there has been a HW error.
> > > +  */
> > > + return -EIO;
> > >   case 8: /* Invalid value within range */
> > >   return -EINVAL;
> > >   default: /* reserved or unknown */

-- 
Regards,

Laurent Pinchart


Re: [PATCH v2 3/6] media: uvcvideo: Return -EIO for control errors

2021-03-11 Thread Ricardo Ribalda Delgado
Hi Laurent

On Thu, Mar 11, 2021 at 11:53 PM Laurent Pinchart
 wrote:
>
> Hi Ricardo,
>
> Thank you for the patch.

Thank you :)
>
> On Thu, Mar 11, 2021 at 11:19:43PM +0100, Ricardo Ribalda wrote:
> > The device is doing something unspected with the control. Either because
> > the protocol is not properly implemented or there has been a HW error.
> >
> > Fixes v4l2-compliance:
> >
> > Control ioctls (Input 0):
> > fail: v4l2-test-controls.cpp(448): s_ctrl returned an error 
> > (22)
> > test VIDIOC_G/S_CTRL: FAIL
> > fail: v4l2-test-controls.cpp(698): s_ext_ctrls returned an 
> > error (22)
> > test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
> >
> > Signed-off-by: Ricardo Ribalda 
>
> The change looks good to me.
>
> Reviewed-by: Laurent Pinchart 
>
> Which of the error codes below do you get with your camera, and for
> which control ?

Bus 001 Device 003: ID 05c8:03a2 Cheng Uei Precision Industry Co., Ltd
(Foxlink) XiaoMi USB 2.0 Webcam

info: checking extended control 'White Balance Temperature' (0x0098091a)
Control error 7
info: checking extended control 'Exposure (Absolute)' (0x009a0902)
Control error 6


>
> > ---
> >  drivers/media/usb/uvc/uvc_video.c | 5 +
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/media/usb/uvc/uvc_video.c 
> > b/drivers/media/usb/uvc/uvc_video.c
> > index f2f565281e63..25fd8aa23529 100644
> > --- a/drivers/media/usb/uvc/uvc_video.c
> > +++ b/drivers/media/usb/uvc/uvc_video.c
> > @@ -112,6 +112,11 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, 
> > u8 unit,
> >   case 5: /* Invalid unit */
> >   case 6: /* Invalid control */
> >   case 7: /* Invalid Request */
> > + /*
> > +  * The firmware has not properly implemented
> > +  * the control or there has been a HW error.
> > +  */
> > + return -EIO;
> >   case 8: /* Invalid value within range */
> >   return -EINVAL;
> >   default: /* reserved or unknown */
>
> --
> Regards,
>
> Laurent Pinchart



-- 
Ricardo Ribalda


Re: [PATCH v2 3/6] media: uvcvideo: Return -EIO for control errors

2021-03-11 Thread Laurent Pinchart
Hi Ricardo,

Thank you for the patch.

On Thu, Mar 11, 2021 at 11:19:43PM +0100, Ricardo Ribalda wrote:
> The device is doing something unspected with the control. Either because
> the protocol is not properly implemented or there has been a HW error.
> 
> Fixes v4l2-compliance:
> 
> Control ioctls (Input 0):
> fail: v4l2-test-controls.cpp(448): s_ctrl returned an error 
> (22)
> test VIDIOC_G/S_CTRL: FAIL
> fail: v4l2-test-controls.cpp(698): s_ext_ctrls returned an 
> error (22)
> test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
> 
> Signed-off-by: Ricardo Ribalda 

The change looks good to me.

Reviewed-by: Laurent Pinchart 

Which of the error codes below do you get with your camera, and for
which control ?

> ---
>  drivers/media/usb/uvc/uvc_video.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/usb/uvc/uvc_video.c 
> b/drivers/media/usb/uvc/uvc_video.c
> index f2f565281e63..25fd8aa23529 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -112,6 +112,11 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 
> unit,
>   case 5: /* Invalid unit */
>   case 6: /* Invalid control */
>   case 7: /* Invalid Request */
> + /*
> +  * The firmware has not properly implemented
> +  * the control or there has been a HW error.
> +  */
> + return -EIO;
>   case 8: /* Invalid value within range */
>   return -EINVAL;
>   default: /* reserved or unknown */

-- 
Regards,

Laurent Pinchart


[PATCH v2 3/6] media: uvcvideo: Return -EIO for control errors

2021-03-11 Thread Ricardo Ribalda
The device is doing something unspected with the control. Either because
the protocol is not properly implemented or there has been a HW error.

Fixes v4l2-compliance:

Control ioctls (Input 0):
fail: v4l2-test-controls.cpp(448): s_ctrl returned an error (22)
test VIDIOC_G/S_CTRL: FAIL
fail: v4l2-test-controls.cpp(698): s_ext_ctrls returned an 
error (22)
test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL

Signed-off-by: Ricardo Ribalda 
---
 drivers/media/usb/uvc/uvc_video.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_video.c 
b/drivers/media/usb/uvc/uvc_video.c
index f2f565281e63..25fd8aa23529 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -112,6 +112,11 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 
unit,
case 5: /* Invalid unit */
case 6: /* Invalid control */
case 7: /* Invalid Request */
+   /*
+* The firmware has not properly implemented
+* the control or there has been a HW error.
+*/
+   return -EIO;
case 8: /* Invalid value within range */
return -EINVAL;
default: /* reserved or unknown */
-- 
2.31.0.rc2.261.g7f71774620-goog