* [PATCH] media: uvcvideo: Add UVC_QUIRK_CTL_MSG_DELAY_1M for HIK camera
@ 2026-10-29 3:31 Kuangyi Chiang
2026-10-29 8:56 ` Laurent Pinchart
2026-10-29 12:46 ` Hans de Goede
0 siblings, 2 replies; 6+ messages in thread
From: Kuangyi Chiang @ 2026-10-29 3:31 UTC (permalink / raw)
To: laurent.pinchart, hansg; +Cc: mchehab, linux-media, linux-kernel, ki.chiang65
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.
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
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: uvcvideo: Add UVC_QUIRK_CTL_MSG_DELAY_1M for HIK camera
2026-10-29 3:31 [PATCH] media: uvcvideo: Add UVC_QUIRK_CTL_MSG_DELAY_1M for HIK camera Kuangyi Chiang
@ 2026-10-29 8:56 ` Laurent Pinchart
2026-11-03 1:08 ` Kuangyi Chiang
2026-10-29 12:46 ` Hans de Goede
1 sibling, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2026-10-29 8:56 UTC (permalink / raw)
To: Kuangyi Chiang; +Cc: hansg, mchehab, linux-media, linux-kernel
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: uvcvideo: Add UVC_QUIRK_CTL_MSG_DELAY_1M for HIK camera
2026-10-29 3:31 [PATCH] media: uvcvideo: Add UVC_QUIRK_CTL_MSG_DELAY_1M for HIK camera Kuangyi Chiang
2026-10-29 8:56 ` Laurent Pinchart
@ 2026-10-29 12:46 ` Hans de Goede
2026-11-03 1:18 ` Kuangyi Chiang
2026-11-05 9:33 ` Michal Pecio
1 sibling, 2 replies; 6+ messages in thread
From: Hans de Goede @ 2026-10-29 12:46 UTC (permalink / raw)
To: Kuangyi Chiang, laurent.pinchart; +Cc: mchehab, linux-media, linux-kernel
Hi,
On 29-Oct-26 4:31 AM, 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.
>
> Signed-off-by: Kuangyi Chiang <ki.chiang65@gmail.com>
Is this a USB-2.0 camera connected to a XHCI controller ?
And if yes, how old is this camera model ?
The reason why I'm asking this is because the EHCI USB-2.0 controller
interface causes a natural delay between consecutive ctrl commands queued
one by one till the start of the next USB frrame, so they get spaced
1 ms apart.
Where as the modern XHCI controller interface will put these back-to-back
on the USB bus. We've seen some issues with (older) USB devices before where
they needed some delay because they were originally only validated with
EHCI controllers and the hw/ff assumes it will get some "breathing space"
between control messages.
Regards,
Hans
> ---
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: uvcvideo: Add UVC_QUIRK_CTL_MSG_DELAY_1M for HIK camera
2026-10-29 8:56 ` Laurent Pinchart
@ 2026-11-03 1:08 ` Kuangyi Chiang
0 siblings, 0 replies; 6+ messages in thread
From: Kuangyi Chiang @ 2026-11-03 1:08 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: hansg, mchehab, linux-media, linux-kernel
Hi,
Thanks for the review.
Laurent Pinchart <laurent.pinchart@ideasonboard.com> 於 2026年10月29日週四 下午4:56寫道:
>
> 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.
We captured USB traces using a protocol analyzer and observed
different behavior between the failing and successful cases.
In the failing case, the device ACKed the DATA stage but kept
NAKing the STATUS stage until the transfer timed out.
In the successful case, the device initially NAKed the DATA stage,
then ACKed it, and the STATUS stage completed successfully.
The patch adds a delay after usb_control_msg() returns, before
the next UVC control request.
Although this delay prevented the timeouts in our tests,
we haven't identified the root cause yet.
We agree that a root cause analysis is needed.
Do you have any suggestions on what else we should investigate?
Regards,
Kuangyi
>
> > 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: uvcvideo: Add UVC_QUIRK_CTL_MSG_DELAY_1M for HIK camera
2026-10-29 12:46 ` Hans de Goede
@ 2026-11-03 1:18 ` Kuangyi Chiang
2026-11-05 9:33 ` Michal Pecio
1 sibling, 0 replies; 6+ messages in thread
From: Kuangyi Chiang @ 2026-11-03 1:18 UTC (permalink / raw)
To: Hans de Goede; +Cc: laurent.pinchart, mchehab, linux-media, linux-kernel
Hi,
Thanks for the review.
Hans de Goede <hansg@kernel.org> 於 2026年10月29日週四 下午8:46寫道:
>
> Hi,
>
> On 29-Oct-26 4:31 AM, 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.
> >
> > Signed-off-by: Kuangyi Chiang <ki.chiang65@gmail.com>
>
> Is this a USB-2.0 camera connected to a XHCI controller ?
>
> And if yes, how old is this camera model ?
Yes, it's a USB 2.0 high-speed camera connected to an xHCI
controller.
It's an entry-level 1080p USB webcam from Hikvision that has
been available for several years.
The enumeration log is shown below:
[ 421.245199] usb 5-3: new high-speed USB device number 2 using xhci_hcd
[ 421.368603] usb 5-3: New USB device found, idVendor=2bdf,
idProduct=0280, bcdDevice=13.00
[ 421.372056] usb 5-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 421.372064] usb 5-3: Product: HIK 1080P Camera
[ 421.372069] usb 5-3: Manufacturer: 04004000_P040200_SN0002
[ 421.372072] usb 5-3: SerialNumber: 04004000_P040200_SN0002
So far, we have reproduced the issue with these xHCI hosts:
ASMedia ASM1142 (1b21:1242)
Etron EJ168 (1b6f:7023)
Etron EJ188 (1b6f:7052)
Intel xHCI (8086:8d31)
>
> The reason why I'm asking this is because the EHCI USB-2.0 controller
> interface causes a natural delay between consecutive ctrl commands queued
> one by one till the start of the next USB frrame, so they get spaced
> 1 ms apart.
>
> Where as the modern XHCI controller interface will put these back-to-back
> on the USB bus. We've seen some issues with (older) USB devices before where
> they needed some delay because they were originally only validated with
> EHCI controllers and the hw/ff assumes it will get some "breathing space"
> between control messages.
Thanks for the explanation. That makes sense.
The camera works with the EHCI host we tested without any
additional delay.
We haven't observed this issue during device enumeration.
In our tests, adding a 1 ms delay to both the UAC and UVC
control request paths prevented the timeouts.
When the delay was added to only one driver, we still observed
control transfer timeouts (-110) in the other driver.
We also submitted a similar patch for the USB audio driver,
using the existing QUIRK_FLAG_CTL_MSG_DELAY_1M:
https://lore.kernel.org/linux-sound/20261029032856.7100-1-ki.chiang65@gmail.com/T/#u
Regards,
Kuangyi
>
> Regards,
>
> Hans
>
>
>
> > ---
> > 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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] media: uvcvideo: Add UVC_QUIRK_CTL_MSG_DELAY_1M for HIK camera
2026-10-29 12:46 ` Hans de Goede
2026-11-03 1:18 ` Kuangyi Chiang
@ 2026-11-05 9:33 ` Michal Pecio
1 sibling, 0 replies; 6+ messages in thread
From: Michal Pecio @ 2026-11-05 9:33 UTC (permalink / raw)
To: Hans de Goede
Cc: Kuangyi Chiang, laurent.pinchart, mchehab, linux-media, linux-kernel
Hi Hans,
Kuangyi Chiang has also reported this to linux-usb and linked here.
On Thu, 29 Oct 2026 13:46:04 +0100, Hans de Goede wrote:
> Is this a USB-2.0 camera connected to a XHCI controller ?
>
> And if yes, how old is this camera model ?
>
> The reason why I'm asking this is because the EHCI USB-2.0 controller
> interface causes a natural delay between consecutive ctrl commands
> queued one by one till the start of the next USB frrame, so they get
> spaced 1 ms apart.
>
> Where as the modern XHCI controller interface will put these
> back-to-back on the USB bus. We've seen some issues with (older) USB
> devices before where they needed some delay because they were
> originally only validated with EHCI controllers and the hw/ff assumes
> it will get some "breathing space" between control messages.
Are you sure that this wasn't possible with EHCI at all?
What sort of devices were affected? A bit surprising to see that there
is apparently no quirk for a known issue.
Regards,
Michal
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-05 9:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 3:31 [PATCH] media: uvcvideo: Add UVC_QUIRK_CTL_MSG_DELAY_1M for HIK camera Kuangyi Chiang
2026-10-29 8:56 ` Laurent Pinchart
2026-11-03 1:08 ` Kuangyi Chiang
2026-10-29 12:46 ` Hans de Goede
2026-11-03 1:18 ` Kuangyi Chiang
2026-11-05 9:33 ` Michal Pecio
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®