From: mglocker Date: Wed, 3 Feb 2021 11:34:24 +0000 (+0000) Subject: After the rev. 1.108 commit we see some issues with ugen(4) behaviour, X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=58176493d883fc502ed475018613bb4dfb53c9d2;p=openbsd After the rev. 1.108 commit we see some issues with ugen(4) behaviour, which finally makes umb(4) fail, since ugen(4) attaches to one of the umb(4) interfaces, fails, and marks the whole device dying. Therefore make usbd_device2interface_handle() backwards compatible again. Problem reported by Mikolaj Kucharski. ok edd@ --- diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index 38785e06c1c..1483faf72e1 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.c,v 1.109 2021/02/01 09:21:51 mglocker Exp $ */ +/* $OpenBSD: usbdi.c,v 1.110 2021/02/03 11:34:24 mglocker Exp $ */ /* $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */ @@ -642,6 +642,10 @@ usbd_device2interface_handle(struct usbd_device *dev, u_int8_t ifaceno, if (dev->cdesc == NULL) return (USBD_NOT_CONFIGURED); + if (ifaceno < dev->cdesc->bNumInterfaces) { + *iface = &dev->ifaces[ifaceno]; + return (USBD_NORMAL_COMPLETION); + } /* * The correct interface should be at dev->ifaces[ifaceno], but we've * seen non-compliant devices in the wild which present non-contiguous