1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 07:13:36 +02:00

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@
This commit is contained in:
kirill
2026-06-02 20:33:29 +00:00
parent f213fe822a
commit cf839b82e3
+38 -4
View File
@@ -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 <robert@openbsd.org>
@@ -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;