From cf839b82e3ec8d563440534b45145304a0edde62 Mon Sep 17 00:00:00 2001 From: kirill Date: Tue, 2 Jun 2026 20:33:29 +0000 Subject: [PATCH] sys/uvideo: fix UVIDEO_FLAG_VENDOR_CLASS attach UVIDEO_FLAG_VENDOR_CLASS has been broken since r1.147: attach selected only UICLASS_VIDEO interfaces, even after match accepted a device whose video control interface incorrectly reports UICLASS_VENDOR. Restore the vendor class path in attach, and add the remaining Logitech vendor class UVC devices listed by Linux for which usbdevs already has product IDs. Issue reported and tested by "requiem." on Logitech QuickCam Pro5000 OK: mglocker@ --- sys/dev/usb/uvideo.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c index dd3cc78613a..998fe297d31 100644 --- a/sys/dev/usb/uvideo.c +++ b/sys/dev/usb/uvideo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvideo.c,v 1.265 2025/09/06 13:45:41 kirill Exp $ */ +/* $OpenBSD: uvideo.c,v 1.266 2026/06/02 20:33:29 kirill Exp $ */ /* * Copyright (c) 2008 Robert Nagy @@ -386,12 +386,42 @@ const struct uvideo_devs { NULL, UVIDEO_FLAG_ISIGHT_STREAM_HEADER }, + { /* Incorrectly reports as bInterfaceClass=UICLASS_VENDOR */ + { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMFUSION_1 }, + NULL, + NULL, + UVIDEO_FLAG_VENDOR_CLASS + }, + { /* Incorrectly reports as bInterfaceClass=UICLASS_VENDOR */ + { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMORBITMP_1 }, + NULL, + NULL, + UVIDEO_FLAG_VENDOR_CLASS + }, + { /* Incorrectly reports as bInterfaceClass=UICLASS_VENDOR */ + { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMNBPRO }, + NULL, + NULL, + UVIDEO_FLAG_VENDOR_CLASS + }, + { /* Incorrectly reports as bInterfaceClass=UICLASS_VENDOR */ + { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMPRO5K_1 }, + NULL, + NULL, + UVIDEO_FLAG_VENDOR_CLASS + }, { /* Incorrectly reports as bInterfaceClass=UICLASS_VENDOR */ { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMOEM_1 }, NULL, NULL, UVIDEO_FLAG_VENDOR_CLASS }, + { /* Incorrectly reports as bInterfaceClass=UICLASS_VENDOR */ + { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_QUICKCAMOEM_2 }, + NULL, + NULL, + UVIDEO_FLAG_VENDOR_CLASS + }, { /* Infrared camera not supported */ { USB_VENDOR_CHICONY, USB_PRODUCT_CHICONY_IRCAMERA }, NULL, @@ -560,6 +590,9 @@ uvideo_attach(struct device *parent, struct device *self, void *aux) sc->sc_udev = uaa->device; + /* maybe the device has quirks */ + sc->sc_quirk = uvideo_lookup(uaa->vendor, uaa->product); + /* Find the first unclaimed video interface. */ for (i = 0; i < uaa->nifaces; i++) { if (usbd_iface_claimed(sc->sc_udev, i)) @@ -569,6 +602,10 @@ uvideo_attach(struct device *parent, struct device *self, void *aux) continue; if (id->bInterfaceClass == UICLASS_VIDEO) break; + if (sc->sc_quirk != NULL && + sc->sc_quirk->flags & UVIDEO_FLAG_VENDOR_CLASS && + id->bInterfaceClass == UICLASS_VENDOR) + break; } if (i == uaa->nifaces) { printf("%s: can't find video interface\n", DEVNAME(sc)); @@ -613,9 +650,6 @@ uvideo_attach(struct device *parent, struct device *self, void *aux) sc->sc_iface = iad->bFirstInterface; sc->sc_nifaces = iad->bInterfaceCount; - /* maybe the device has quirks */ - sc->sc_quirk = uvideo_lookup(uaa->vendor, uaa->product); - if (sc->sc_quirk && sc->sc_quirk->flags & UVIDEO_FLAG_NOATTACH) { printf("%s: device not supported\n", DEVNAME(sc)); return;