mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kuangyi Chiang <ki.chiang65@gmail.com>
Cc: hansg@kernel.org, mchehab@kernel.org,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: uvcvideo: Add UVC_QUIRK_CTL_MSG_DELAY_1M for HIK camera
Date: Thu, 29 Oct 2026 10:56:10 +0200	[thread overview]
Message-ID: <20261029085610.GC2673734@killaraus.ideasonboard.com> (raw)
In-Reply-To: <20261029033106.7374-1-ki.chiang65@gmail.com>

On Thu, Oct 29, 2026 at 11:31:06AM +0800, Kuangyi Chiang wrote:
> UVC control requests issued when preparing a video stream sometimes
> time out on the HIK 1080P Camera (2bdf:0280):
> 
> [   48.363671] uvcvideo: Found UVC 1.00 device HIK 1080P Camera (2bdf:0280)
> [   53.465662] uvcvideo: Failed to set UVC probe control : -110 (exp. 26).
> [   58.585653] uvcvideo: Failed to query (129) UVC probe control : -110 (exp. 26).
> [   58.592967] uvcvideo: Failed to initialize the device (-5).
> 
> Adding a 1ms delay after each control message avoids the issue.
> 
> Introduce UVC_QUIRK_CTL_MSG_DELAY_1M for this device.

We don't add random delays. This needs a root cause analysis.

> Signed-off-by: Kuangyi Chiang <ki.chiang65@gmail.com>
> ---
>  drivers/media/usb/uvc/uvc_driver.c |  9 +++++++++
>  drivers/media/usb/uvc/uvc_video.c  | 10 ++++++++--
>  drivers/media/usb/uvc/uvcvideo.h   |  1 +
>  3 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index e289cc7..c720d75 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -3162,6 +3162,15 @@ static const struct usb_device_id uvc_ids[] = {
>  	  .bInterfaceSubClass	= 1,
>  	  .bInterfaceProtocol	= 0,
>  	  .driver_info		= UVC_INFO_QUIRK(UVC_QUIRK_FORCE_BPP) },
> +	/* HIK 1080P Camera */
> +	{ .match_flags		= USB_DEVICE_ID_MATCH_DEVICE
> +				| USB_DEVICE_ID_MATCH_INT_INFO,
> +	  .idVendor		= 0x2bdf,
> +	  .idProduct		= 0x0280,
> +	  .bInterfaceClass	= USB_CLASS_VIDEO,
> +	  .bInterfaceSubClass	= 1,
> +	  .bInterfaceProtocol	= 0,
> +	  .driver_info		= UVC_INFO_QUIRK(UVC_QUIRK_CTL_MSG_DELAY_1M) },
>  	/* Insta360 Link */
>  	{ .match_flags		= USB_DEVICE_ID_MATCH_DEVICE
>  				| USB_DEVICE_ID_MATCH_INT_INFO,
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index fc3536a..4667f86 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -35,13 +35,19 @@ static int __uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
>  {
>  	u8 type = USB_TYPE_CLASS | USB_RECIP_INTERFACE;
>  	unsigned int pipe;
> +	int ret;
>  
>  	pipe = (query & 0x80) ? usb_rcvctrlpipe(dev->udev, 0)
>  			      : usb_sndctrlpipe(dev->udev, 0);
>  	type |= (query & 0x80) ? USB_DIR_IN : USB_DIR_OUT;
>  
> -	return usb_control_msg(dev->udev, pipe, query, type, cs << 8,
> -			unit << 8 | intfnum, data, size, timeout);
> +	ret = usb_control_msg(dev->udev, pipe, query, type, cs << 8,
> +			      unit << 8 | intfnum, data, size, timeout);
> +
> +	if (dev->quirks & UVC_QUIRK_CTL_MSG_DELAY_1M)
> +		usleep_range(1000, 2000);
> +
> +	return ret;
>  }
>  
>  static const char *uvc_query_name(u8 query)
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index b6bcee4..1426d14 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -81,6 +81,7 @@
>  #define UVC_QUIRK_INVALID_DEVICE_SOF	0x00010000
>  #define UVC_QUIRK_MJPEG_NO_EOF		0x00020000
>  #define UVC_QUIRK_MSXU_META		0x00040000
> +#define UVC_QUIRK_CTL_MSG_DELAY_1M	0x00080000
>  
>  /* Format flags */
>  #define UVC_FMT_FLAG_COMPRESSED		0x00000001

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2026-10-29  8:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  3:31 Kuangyi Chiang
2026-10-29  8:56 ` Laurent Pinchart [this message]
2026-10-29 12:46 ` Hans de Goede

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=20261029085610.GC2673734@killaraus.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hansg@kernel.org \
    --cc=ki.chiang65@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®