Linux USB
 help / color / mirror / Atom feed
* [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5)
  2026-06-29 16:38 [PATCH 1/2] media: uvcvideo: add quirks for per-device stream error handling Pol Fernández Fernández
@ 2026-06-29 16:38 ` Pol Fernández Fernández
  2026-08-16  5:20   ` kernel test robot
  0 siblings, 1 reply; 5+ messages in thread
From: Pol Fernández Fernández @ 2026-06-29 16:38 UTC (permalink / raw)
  To: linux-media
  Cc: laurent.pinchart, linux-usb, linux-kernel,
	Pol Fernández Fernández

The Logitech HD Pro Webcam C920 variant with USB ID 046d:08e5 is not
present in the device ID table and is matched only by the generic UVC
catch-all entry, receiving no device-specific quirks.

This device intermittently sends MJPEG frames at 1920x1080/30fps
without the EOI (0xFF 0xD9) End of Image marker, correctly signaling
the incomplete frame via UVC_STREAM_ERR in the UVC payload header.
Applications using strict JPEG decoders (libjpeg) display the corrupted
portion as a gray band covering the remainder of the frame. The issue
does not occur on Windows.

Two contributing factors were identified:

1. The C920 (08e5) operates at the USB 2.0 High Speed isochronous
   ceiling (wMaxPacketSize = 3x1024 = 3072 bytes, altsetting 11).
   The camera firmware has an intermittent bug where it occasionally
   fails to finalize a JPEG frame and signals this correctly via
   UVC_STREAM_ERR. No USB-level isochronous packet failures were
   observed (iso_frame_desc.status was always 0).

2. uvcvideo forces wCompQuality to the maximum value returned by
   GET_MAX during probe negotiation (61 for this device, on a
   firmware-specific scale). The camera's default value from GET_CUR
   is 0, which this firmware uses to indicate adaptive encoding mode.
   Forcing maximum quality increases encoder pressure and raises the
   frequency of UVC_STREAM_ERR events.

Add a device table entry with:
- UVC_QUIRK_RESTORE_CTRLS_ON_INIT and UVC_QUIRK_INVALID_DEVICE_SOF,
  consistent with the existing entry for the related 046d:082d variant
  of the same camera family.
- UVC_QUIRK_NO_FORCE_QUALITY to preserve wCompQuality=0 (adaptive
  mode) during probe negotiation rather than overriding it with the
  maximum value.
- UVC_QUIRK_DROP_STREAM_ERR to ensure frames flagged with
  UVC_STREAM_ERR are silently dropped rather than delivered to
  userspace as truncated JPEG data.

Tested on Linux 7.0.0 at 1920x1080 MJPEG 30fps. With this fix, 0
truncated frames were observed in 300-frame capture sequences
(previously 1-2% of frames were affected).

Signed-off-by: Pol Fernández Fernández <fernandezfernandezpol@gmail.com>
---
 drivers/media/usb/uvc/uvc_driver.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index XXXXXXX..XXXXXXX 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -2729,6 +2729,18 @@
 	  .bInterfaceSubClass	= 1,
 	  .bInterfaceProtocol	= 0,
 	  .driver_info		= UVC_INFO_QUIRK(UVC_QUIRK_NO_RESET_RESUME) },
+	/* Logitech HD Pro Webcam C920 (variant 08e5) */
+	{ .match_flags		= USB_DEVICE_ID_MATCH_DEVICE
+				| USB_DEVICE_ID_MATCH_INT_INFO,
+	  .idVendor		= 0x046d,
+	  .idProduct		= 0x08e5,
+	  .bInterfaceClass	= USB_CLASS_VIDEO,
+	  .bInterfaceSubClass	= 1,
+	  .bInterfaceProtocol	= 0,
+	  .driver_info		= UVC_INFO_QUIRK(UVC_QUIRK_RESTORE_CTRLS_ON_INIT
+					       | UVC_QUIRK_INVALID_DEVICE_SOF
+					       | UVC_QUIRK_NO_FORCE_QUALITY
+					       | UVC_QUIRK_DROP_STREAM_ERR) },
 	/* Chicony CNF7129 (Asus EEE 100HE) */
 	{ .match_flags		= USB_DEVICE_ID_MATCH_DEVICE
 				| USB_DEVICE_ID_MATCH_INT_INFO,
--
2.43.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5)
  2026-06-29 16:38 ` [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5) Pol Fernández Fernández
@ 2026-08-16  5:20   ` kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-08-16  5:20 UTC (permalink / raw)
  To: Pol Fernández Fernández, linux-media
  Cc: oe-kbuild-all, laurent.pinchart, linux-usb, linux-kernel,
	Pol Fernández Fernández

Hi Pol,

kernel test robot noticed the following build errors:

[auto build test ERROR on linuxtv-media-pending/master]
[also build test ERROR on media-tree/master sailus-media-tree/master linus/master v7.2-rc7 next-20260721]
[cannot apply to sailus-media-tree/streams]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Pol-Fern-ndez-Fern-ndez/media-uvcvideo-add-device-entry-for-Logitech-C920-046d-08e5/20260814-213320
base:   https://git.linuxtv.org/media-ci/media-pending.git master
patch link:    https://lore.kernel.org/r/20260629163805.37879-2-fernandezfernandezpol%40gmail.com
patch subject: [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5)
config: x86_64-rhel-9.4-bpf (https://download.01.org/0day-ci/archive/20260816/202608160712.l89JPkSj-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260816/202608160712.l89JPkSj-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608160712.l89JPkSj-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/media/usb/uvc/uvc_queue.c: In function 'uvc_queue_buffer_complete':
>> drivers/media/usb/uvc/uvc_queue.c:360:14: error: implicit declaration of function 'uvc_queue_to_stream'; did you mean 'uvc_queue_streaming'? [-Wimplicit-function-declaration]
     360 |             (uvc_queue_to_stream(queue)->dev->quirks & UVC_QUIRK_DROP_STREAM_ERR))) {
         |              ^~~~~~~~~~~~~~~~~~~
         |              uvc_queue_streaming
>> drivers/media/usb/uvc/uvc_queue.c:360:40: error: invalid type argument of '->' (have 'int')
     360 |             (uvc_queue_to_stream(queue)->dev->quirks & UVC_QUIRK_DROP_STREAM_ERR))) {
         |                                        ^~


vim +360 drivers/media/usb/uvc/uvc_queue.c

   352	
   353	static void uvc_queue_buffer_complete(struct kref *ref)
   354	{
   355		struct uvc_buffer *buf = container_of(ref, struct uvc_buffer, ref);
   356		struct vb2_buffer *vb = &buf->buf.vb2_buf;
   357		struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue);
   358	
   359		if (buf->error && (!uvc_no_drop_param ||
 > 360		    (uvc_queue_to_stream(queue)->dev->quirks & UVC_QUIRK_DROP_STREAM_ERR))) {
   361			uvc_queue_buffer_requeue(queue, buf);
   362			return;
   363		}
   364	
   365		buf->state = buf->error ? UVC_BUF_STATE_ERROR : UVC_BUF_STATE_DONE;
   366		vb2_set_plane_payload(&buf->buf.vb2_buf, 0, buf->bytesused);
   367		vb2_buffer_done(&buf->buf.vb2_buf, buf->error ? VB2_BUF_STATE_ERROR :
   368								VB2_BUF_STATE_DONE);
   369	}
   370	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5)
@ 2026-11-22 23:58 Bob Summerwill
  2026-11-23  9:46 ` Ricardo Ribalda
  0 siblings, 1 reply; 5+ messages in thread
From: Bob Summerwill @ 2026-11-22 23:58 UTC (permalink / raw)
  To: fernandezfernandezpol
  Cc: laurent.pinchart, linux-kernel, linux-media, linux-usb

Hi,

Field confirmation of this series' diagnosis from a stock, unpatched
kernel, in case it is useful when considering the patches.

Device: Logitech HD Pro Webcam C920, 046d:08e5, bcdDevice 0.21,
directly connected on USB 2.0 (no hub).

Kernel: 7.2.15 (Arch "linux-omarchy" build). The camera has no
device-table entry here, so it rides the generic UVC catch-all and
uvc_no_drop_param is at its default of 1 (deliver error frames).

Behaviour matches the commit message exactly: intermittent gray
bands over the picture in applications using strict JPEG decoding.
Setting the module parameter nodrop=0 -- the global equivalent of
this series' UVC_QUIRK_DROP_STREAM_ERR -- makes the artifacts
disappear entirely. With it in place, 300-frame MJPEG captures at
both 1280x720 and 1920x1080 sustain ~27 fps, with per-frame mean
luminance stable to within 1/255 across the burst. The camera has
been in daily use since, artifact-free.

To be explicit: this is confirmation of the failure mode and of the
workaround on the affected hardware, not a Tested-by for the series
itself -- I have not built these patches. I am happy to do a real
out-of-tree build against 7.2.15 and follow up with a proper
Tested-by if that would help the series along.

Bob Summerwill


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5)
  2026-11-22 23:58 [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5) Bob Summerwill
@ 2026-11-23  9:46 ` Ricardo Ribalda
  2026-11-23 21:32   ` Bob Summerwill
  0 siblings, 1 reply; 5+ messages in thread
From: Ricardo Ribalda @ 2026-11-23  9:46 UTC (permalink / raw)
  To: Bob Summerwill
  Cc: fernandezfernandezpol, laurent.pinchart, linux-kernel,
	linux-media, linux-usb

Hi Bob

On Mon, 23 Nov 2026 at 00:59, Bob Summerwill
<bobsummerwill@protonmail.com> wrote:
>
> Hi,
>
> Field confirmation of this series' diagnosis from a stock, unpatched
> kernel, in case it is useful when considering the patches.
>
> Device: Logitech HD Pro Webcam C920, 046d:08e5, bcdDevice 0.21,
> directly connected on USB 2.0 (no hub).
>
> Kernel: 7.2.15 (Arch "linux-omarchy" build). The camera has no
> device-table entry here, so it rides the generic UVC catch-all and
> uvc_no_drop_param is at its default of 1 (deliver error frames).
>
> Behaviour matches the commit message exactly: intermittent gray
> bands over the picture in applications using strict JPEG decoding.
> Setting the module parameter nodrop=0 -- the global equivalent of
> this series' UVC_QUIRK_DROP_STREAM_ERR -- makes the artifacts
> disappear entirely. With it in place, 300-frame MJPEG captures at
> both 1280x720 and 1920x1080 sustain ~27 fps, with per-frame mean
> luminance stable to within 1/255 across the burst. The camera has
> been in daily use since, artifact-free.

Can you share what app you are using?

It likely needs to be fixed to check for V4L2_BUF_FLAG_ERROR and skip
those error frames.

Thanks!

>
> To be explicit: this is confirmation of the failure mode and of the
> workaround on the affected hardware, not a Tested-by for the series
> itself -- I have not built these patches. I am happy to do a real
> out-of-tree build against 7.2.15 and follow up with a proper
> Tested-by if that would help the series along.
>
> Bob Summerwill
>
>


-- 
Ricardo Ribalda

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5)
  2026-11-23  9:46 ` Ricardo Ribalda
@ 2026-11-23 21:32   ` Bob Summerwill
  0 siblings, 0 replies; 5+ messages in thread
From: Bob Summerwill @ 2026-11-23 21:32 UTC (permalink / raw)
  To: ribalda
  Cc: fernandezfernandezpol, laurent.pinchart, linux-kernel,
	linux-media, linux-usb

Hi Ricardo,

The app is Monologue, the default camera app of the Linux desktop I
run (Omarchy, an Arch-based distro):

  https://github.com/omacom/monologue

Qt 6 Multimedia with the FFmpeg backend, decoding the camera's MJPEG
stream.

You are right that the app should skip those frames, and upstream has
since added exactly that kind of skip, shipped in 0.3.1 -- it scans
each arriving JPEG frame for the EOI marker and drops incomplete ones
before they reach preview or the recording:

  https://github.com/omacom/monologue/pull/40

My daily-driver config also keeps nodrop=0, so I am artifact-free on
both layers.

One nuance on "check for V4L2_BUF_FLAG_ERROR", though: Qt Multimedia
does not surface that flag to applications. QVideoFrame carries no
corrupt/error marker, and the FFmpeg V4L2 capture path passes error
frames through unannotated, so an application using Qt cannot do the
proper check -- the app-side skip has to be a bitstream-level
heuristic. I have filed an issue documenting that gap and the
layering; the proper fix wants to happen inside Qt's V4L2/FFmpeg
backend:

  https://github.com/omacom/monologue/issues/53

The same applies to every consumer which cannot be fixed that way --
browsers reaching the camera through PipeWire, ffmpeg, CLI tools --
so for this hardware I would still argue the device-table entry with
UVC_QUIRK_DROP_STREAM_ERR is the right fix, with app-side skipping
as defense in depth.

The offer of a real out-of-tree build of the series against 7.2.15,
followed by a proper Tested-by, still stands.

Bob Summerwill


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-23 21:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 23:58 [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5) Bob Summerwill
2026-11-23  9:46 ` Ricardo Ribalda
2026-11-23 21:32   ` Bob Summerwill
  -- strict thread matches above, loose matches on Subject: below --
2026-06-29 16:38 [PATCH 1/2] media: uvcvideo: add quirks for per-device stream error handling Pol Fernández Fernández
2026-06-29 16:38 ` [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5) Pol Fernández Fernández
2026-08-16  5:20   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox