[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y60Itu7apCFpCKzW@pendragon.ideasonboard.com>
Date: Thu, 29 Dec 2022 05:25:42 +0200
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Ricardo Ribalda <ribalda@...omium.org>
Cc: Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil@...all.nl>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Hans Verkuil <hans.verkuil@...co.com>
Subject: Re: [PATCH RESEND v2 3/7] media: uvcvideo: Return -EACCES for Wrong
state error
Hi Ricardo,
Thank you for the patch.
On Fri, Dec 02, 2022 at 06:21:37PM +0100, Ricardo Ribalda wrote:
> For error 2 (Wrong state) return -EACCES instead of -EILSEQ.
> EACCES is a much more appropriate error code. EILSEQ will return
> "Invalid or incomplete multibyte or wide character." in strerror(),
> which is a *very* confusing message.
Unless there's an objection, I'd like to use the following text to
replace the commit message to provide more information:
Error 2 is defined by UVC as
Wrong State: The device is in a state that disallows the specific
request. The device will remain in this state until a specific action
from the host or the user is completed.
This is documented as happening happen when attempting to set the value
of a manual control when the device is in auto mode. While V4L2 allows
this, the closest error code defined by VIDIOC_S_CTRL is indeed EACCES:
EACCES
Attempt to set a read-only control or to get a write-only control.
Or if there is an attempt to set an inactive control and the driver
is not capable of caching the new value until the control is active
again.
Replace EILSEQ with EACCESS.
> Suggested-by: Hans Verkuil <hans.verkuil@...co.com>
> Signed-off-by: Ricardo Ribalda <ribalda@...omium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> ---
> drivers/media/usb/uvc/uvc_video.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index 2cf7f692c0bb..497073a50194 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -108,7 +108,7 @@ int uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
> case 1: /* Not ready */
> return -EBUSY;
> case 2: /* Wrong state */
> - return -EILSEQ;
> + return -EACCES;
> case 3: /* Power */
> return -EREMOTE;
> case 4: /* Out of range */
>
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists