Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: sys/uvideo: attach the first video streaming interface
To:
tech@openbsd.org, mglocker@openbsd.org
Date:
Wed, 19 Feb 2025 09:31:05 +0100

Download raw body.

Thread
On Tue, 18 Feb 2025 23:55:13 +0100,
Kirill A. Korinsky <kirill@korins.ky> wrote:
> 
> tech@,
> 
> right now some webcam migth not be supported because our driver expects
> that the first video interface is video streaming interface, which might
> not be true.
> 
> Here a patch which is filtering non streaming interfaces.
> 
Again, my diff-juggling leads to an errror. I mean this diff.

Differences with already sent one is || instead && in second hunk.

Index: sys/dev/usb/uvideo.c
===================================================================
RCS file: /home/cvs/src/sys/dev/usb/uvideo.c,v
diff -u -p -r1.238 uvideo.c
--- sys/dev/usb/uvideo.c	15 Feb 2025 09:05:15 -0000	1.238
+++ sys/dev/usb/uvideo.c	18 Feb 2025 18:37:43 -0000
@@ -513,14 +513,15 @@ uvideo_attach(struct device *parent, str
 
 	sc->sc_udev = uaa->device;
 
-	/* Find the first unclaimed video interface. */
+	/* Find the first unclaimed video streaming interface. */
 	for (i = 0; i < uaa->nifaces; i++) {
 		if (usbd_iface_claimed(sc->sc_udev, i))
 			continue;
 		id = usbd_get_interface_descriptor(&sc->sc_udev->ifaces[i]);
 		if (id == NULL)
 			continue;
-		if (id->bInterfaceClass == UICLASS_VIDEO)
+		if (id->bInterfaceClass == UICLASS_VIDEO &&
+		    id->bInterfaceSubClass == UISUBCLASS_VIDEOSTREAM)
 			break;
 	}
 	if (i == uaa->nifaces) {
@@ -537,6 +538,11 @@ uvideo_attach(struct device *parent, str
 			continue;
 		}
 		iad = (usb_interface_assoc_descriptor_t *)desc;
+		if (iad->bFunctionClass != UICLASS_VIDEO ||
+		    iad->bFunctionSubClass != UISUBCLASS_VIDEOSTREAM) {
+			desc = usbd_desc_iter_next(&iter);
+			continue;
+		}
 		if (i >= iad->bFirstInterface &&
 		    i < iad->bFirstInterface + iad->bInterfaceCount)
 			break;


-- 
wbr, Kirill