From: Kirill A. Korinsky Subject: Support LG UltraFine Display Camera To: OpenBSD tech Cc: Marcus Glocker , Klemens Nanni Date: Sat, 30 Nov 2024 23:25:15 +0100 tech@, A new quirk UVIDEO_FLAG_RENEGOTIATE_AFTER_SET_ALT from this thread [1] is required for at least one more camera: LG UltraFine Display Camera. And this camera allows to discover a bug with bulk processing inside uvideo: here usbd_get_xfer_status is missing and current code is built on the assumption that device always returns dwMaxPayloadTransferSize bytes. Here is a diff that adds the missing usbd_get_xfer_status and the quirk. Feedback? Tests? Ok? Index: sys/dev/usb/uvideo.c =================================================================== RCS file: /home/cvs/src/sys/dev/usb/uvideo.c,v diff -u -p -r1.224 uvideo.c --- sys/dev/usb/uvideo.c 30 Nov 2024 17:47:23 -0000 1.224 +++ sys/dev/usb/uvideo.c 30 Nov 2024 22:20:00 -0000 @@ -386,6 +386,12 @@ const struct uvideo_devs { NULL, UVIDEO_FLAG_RENEGOTIATE_AFTER_SET_ALT }, + { /* Needs renegotiate after setting alternate interface */ + { USB_VENDOR_LG, USB_PRODUCT_LG_ULTRA_FINE_VIDEO }, + NULL, + NULL, + UVIDEO_FLAG_RENEGOTIATE_AFTER_SET_ALT + }, }; #define uvideo_lookup(v, p) \ ((const struct uvideo_devs *)usb_lookup(uvideo_devs, v, p)) @@ -2051,6 +2057,9 @@ uvideo_vs_start_bulk_thread(void *arg) DEVNAME(sc), usbd_errstr(error)); break; } + + usbd_get_xfer_status(sc->sc_vs_cur->bxfer.xfer, + NULL, NULL, &size, NULL); DPRINTF(2, "%s: *** buffer len = %d\n", DEVNAME(sc), size); Index: sys/dev/usb/usbdevs =================================================================== RCS file: /home/cvs/src/sys/dev/usb/usbdevs,v diff -u -p -r1.772 usbdevs --- sys/dev/usb/usbdevs 30 Nov 2024 17:41:57 -0000 1.772 +++ sys/dev/usb/usbdevs 30 Nov 2024 22:21:37 -0000 @@ -2704,6 +2704,7 @@ product LEXMARK S2450 0x0009 Optra S 24 /* LG products */ product LG RTL8153 0x9819 RTL8153 product LG RTL8153B 0x9820 RTL8153 +product LG ULTRA_FINE_VIDEO 0x9a68 LG UltraFine Display Camera /* Liebert products */ product LIEBERT UPS 0xffff UPS Index: share/man/man4/uvideo.4 =================================================================== RCS file: /home/cvs/src/share/man/man4/uvideo.4,v diff -u -p -r1.44 uvideo.4 --- share/man/man4/uvideo.4 30 Nov 2024 20:15:03 -0000 1.44 +++ share/man/man4/uvideo.4 30 Nov 2024 22:07:06 -0000 @@ -47,6 +47,8 @@ Jabra PanaCast 20 .It Lenovo EasyCamera (Lenovo IdeaPad s10e Notebooks) .It +LG UltraFine Display Camera +.It Logitech QuickCam for Notebooks Pro .It Logitech QuickCam Communicate Deluxe Footnotes: [1] https://marc.info/?t=173266150800001&r=1&w=2 -- wbr, Kirill