Linux USB
 help / color / mirror / Atom feed
From: "Pol Fernández Fernández" <fernandezfernandezpol@gmail.com>
To: linux-media@vger.kernel.org
Cc: laurent.pinchart@ideasonboard.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Pol Fernández Fernández" <fernandezfernandezpol@gmail.com>
Subject: [PATCH 2/2] media: uvcvideo: add device entry for Logitech C920 (046d:08e5)
Date: Mon, 29 Jun 2026 18:38:03 +0200	[thread overview]
Message-ID: <20260629163805.37879-2-fernandezfernandezpol@gmail.com> (raw)
In-Reply-To: <20260629163805.37879-1-fernandezfernandezpol@gmail.com>

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

  reply	other threads:[~2026-06-29 16:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-06-29 16:55 ` Ricardo Ribalda
2026-06-29 18:23 ` Laurent Pinchart

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=20260629163805.37879-2-fernandezfernandezpol@gmail.com \
    --to=fernandezfernandezpol@gmail.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.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