All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ricardo Ribalda <ribalda@chromium.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCH RESEND v2 3/7] media: uvcvideo: Return -EACCES for Wrong state error
Date: Thu, 29 Dec 2022 05:25:42 +0200	[thread overview]
Message-ID: <Y60Itu7apCFpCKzW@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220920-resend-v4l2-compliance-v2-3-b0ceb15353ac@chromium.org>

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@cisco.com>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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

  reply	other threads:[~2022-12-29  3:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-02 17:21 [PATCH RESEND v2 0/7] Follow-up patches for uvc v4l2-compliance Ricardo Ribalda
2022-12-02 17:21 ` [PATCH RESEND v2 1/7] media: uvcvideo: uvc_ctrl_is_accessible: check for INACTIVE Ricardo Ribalda
2022-12-29 20:54   ` Laurent Pinchart
2022-12-02 17:21 ` [PATCH RESEND v2 2/7] media: uvcvideo: improve error logging in uvc_query_ctrl() Ricardo Ribalda
2022-12-29  2:59   ` Laurent Pinchart
2022-12-02 17:21 ` [PATCH RESEND v2 3/7] media: uvcvideo: Return -EACCES for Wrong state error Ricardo Ribalda
2022-12-29  3:25   ` Laurent Pinchart [this message]
2022-12-02 17:21 ` [PATCH RESEND v2 4/7] media: uvcvideo: Do not return positive errors in uvc_query_ctrl() Ricardo Ribalda
2022-12-29  3:28   ` Laurent Pinchart
2022-12-02 17:21 ` [PATCH RESEND v2 5/7] media: uvcvideo: Fix handling on Bitmask controls Ricardo Ribalda
2022-12-29 21:25   ` Laurent Pinchart
2022-12-02 17:21 ` [PATCH RESEND v2 6/7] media: uvcvideo: Implement mask for V4L2_CTRL_TYPE_MENU Ricardo Ribalda
2022-12-29  2:50   ` Laurent Pinchart
2022-12-02 17:21 ` [PATCH RESEND v2 7/7] media: uvcvideo: Use standard names for menus Ricardo Ribalda
2022-12-29 22:06   ` Laurent Pinchart
2022-12-29 22:13 ` [PATCH RESEND v2 0/7] Follow-up patches for uvc v4l2-compliance Laurent Pinchart
2023-01-03 14:37   ` Ricardo Ribalda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y60Itu7apCFpCKzW@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hans.verkuil@cisco.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.