From f24761612bf58e5bc210e13dab4750bb85c26a63 Mon Sep 17 00:00:00 2001 From: mglocker Date: Wed, 27 Jan 2021 17:28:19 +0000 Subject: [PATCH] The usb configuration descriptor parameter providing the number of available device interfaces is called 'bNumInterfaces'. ok phessler@, thfr@ (who provided the man page diff) --- share/man/man4/ugen.4 | 6 +++--- sys/dev/usb/ugen.c | 6 +++--- sys/dev/usb/uplcom.c | 4 ++-- sys/dev/usb/usb.h | 4 ++-- sys/dev/usb/usb_subr.c | 10 +++++----- sys/dev/usb/usbdi.c | 4 ++-- sys/dev/usb/uvideo.c | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/share/man/man4/ugen.4 b/share/man/man4/ugen.4 index b4da46e73ca..b588167a1c8 100644 --- a/share/man/man4/ugen.4 +++ b/share/man/man4/ugen.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ugen.4,v 1.17 2016/05/24 05:47:16 mpi Exp $ +.\" $OpenBSD: ugen.4,v 1.18 2021/01/27 17:28:19 mglocker Exp $ .\" $NetBSD: ugen.4,v 1.7 1999/07/30 01:32:05 augustss Exp $ .\" .\" Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: May 24 2016 $ +.Dd $Mdocdate: January 27 2021 $ .Dt UGEN 4 .Os .Sh NAME @@ -259,7 +259,7 @@ All endpoints (except the control endpoint) for the current configuration can be found by iterating the .Fa interface_index from 0 to -.Fa config_desc->bNumInterface-1 +.Fa config_desc->bNumInterfaces-1 and for each of these iterating the .Fa endpoint_index from 0 to diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index af8a80306c1..24e7a408adb 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.111 2021/01/27 08:32:46 mglocker Exp $ */ +/* $OpenBSD: ugen.c,v 1.112 2021/01/27 17:28:19 mglocker Exp $ */ /* $NetBSD: ugen.c,v 1.63 2002/11/26 18:49:48 christos Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -224,7 +224,7 @@ ugen_set_config(struct ugen_softc *sc, int configno) } memset(sc->sc_endpoints, 0, sizeof sc->sc_endpoints); - for (ifaceno = 0; ifaceno < cdesc->bNumInterface; ifaceno++) { + for (ifaceno = 0; ifaceno < cdesc->bNumInterfaces; ifaceno++) { DPRINTFN(1,("ugen_set_config: ifaceno %d\n", ifaceno)); if (usbd_iface_claimed(sc->sc_udev, ifaceno)) { DPRINTF(("%s: iface %d not available\n", __func__, @@ -906,7 +906,7 @@ ugen_set_interface(struct ugen_softc *sc, int ifaceidx, int altno) DPRINTFN(15, ("ugen_set_interface %d %d\n", ifaceidx, altno)); cdesc = usbd_get_config_descriptor(sc->sc_udev); - if (ifaceidx < 0 || ifaceidx >= cdesc->bNumInterface || + if (ifaceidx < 0 || ifaceidx >= cdesc->bNumInterfaces || usbd_iface_claimed(sc->sc_udev, ifaceidx)) return (USBD_INVAL); diff --git a/sys/dev/usb/uplcom.c b/sys/dev/usb/uplcom.c index 2bf98e33f04..7c50902c540 100644 --- a/sys/dev/usb/uplcom.c +++ b/sys/dev/usb/uplcom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uplcom.c,v 1.76 2020/11/13 13:04:53 patrick Exp $ */ +/* $OpenBSD: uplcom.c,v 1.77 2021/01/27 17:28:19 mglocker Exp $ */ /* $NetBSD: uplcom.c,v 1.29 2002/09/23 05:51:23 simonb Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -339,7 +339,7 @@ uplcom_attach(struct device *parent, struct device *self, void *aux) * BulkIN(0x02) | * BulkOUT(0x83) | */ - if (cdesc->bNumInterface == 2) { + if (cdesc->bNumInterfaces == 2) { err = usbd_device2interface_handle(dev, UPLCOM_SECOND_IFACE_INDEX, &sc->sc_iface); if (err) { diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index 413e06794e3..82d36deb8ae 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.h,v 1.61 2018/07/19 12:35:14 mpi Exp $ */ +/* $OpenBSD: usb.h,v 1.62 2021/01/27 17:28:19 mglocker Exp $ */ /* $NetBSD: usb.h,v 1.69 2002/09/22 23:20:50 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $ */ @@ -199,7 +199,7 @@ struct usb_config_descriptor { uByte bLength; uByte bDescriptorType; uWord wTotalLength; - uByte bNumInterface; + uByte bNumInterfaces; uByte bConfigurationValue; uByte iConfiguration; uByte bmAttributes; diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 231be7676cd..802c85b9b9a 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.152 2020/08/27 19:34:37 mglocker Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.153 2021/01/27 17:28:19 mglocker Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -644,7 +644,7 @@ usbd_set_config_index(struct usbd_device *dev, int index, int msg) if (dev->config != USB_UNCONFIG_NO) { DPRINTF(("%s: free old config\n", __func__)); /* Free all configuration data structures. */ - nifc = dev->cdesc->bNumInterface; + nifc = dev->cdesc->bNumInterfaces; for (ifcidx = 0; ifcidx < nifc; ifcidx++) usbd_free_iface_data(dev, ifcidx); free(dev->ifaces, M_USB, nifc * sizeof(*dev->ifaces)); @@ -770,7 +770,7 @@ usbd_set_config_index(struct usbd_device *dev, int index, int msg) } /* Allocate and fill interface data. */ - nifc = cdp->bNumInterface; + nifc = cdp->bNumInterfaces; dev->ifaces = mallocarray(nifc, sizeof(*dev->ifaces), M_USB, M_NOWAIT | M_ZERO); if (dev->ifaces == NULL) { @@ -918,7 +918,7 @@ usbd_probe_and_attach(struct device *parent, struct usbd_device *dev, int port, goto fail; } - nifaces = dev->cdesc->bNumInterface; + nifaces = dev->cdesc->bNumInterfaces; uaa.configno = dev->cdesc->bConfigurationValue; ifaces = mallocarray(nifaces, sizeof(*ifaces), M_USB, M_NOWAIT); if (ifaces == NULL) { @@ -1406,7 +1406,7 @@ usb_free_device(struct usbd_device *dev) if (dev->default_pipe != NULL) usbd_close_pipe(dev->default_pipe); if (dev->ifaces != NULL) { - nifc = dev->cdesc->bNumInterface; + nifc = dev->cdesc->bNumInterfaces; for (ifcidx = 0; ifcidx < nifc; ifcidx++) usbd_free_iface_data(dev, ifcidx); free(dev->ifaces, M_USB, nifc * sizeof(*dev->ifaces)); diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index ecb17c3bf4f..a6be95a040a 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.c,v 1.106 2020/04/03 20:11:47 patrick Exp $ */ +/* $OpenBSD: usbdi.c,v 1.107 2021/01/27 17:28:19 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 $ */ @@ -640,7 +640,7 @@ usbd_device2interface_handle(struct usbd_device *dev, u_int8_t ifaceno, { if (dev->cdesc == NULL) return (USBD_NOT_CONFIGURED); - if (ifaceno >= dev->cdesc->bNumInterface) + if (ifaceno >= dev->cdesc->bNumInterfaces) return (USBD_INVAL); *iface = &dev->ifaces[ifaceno]; return (USBD_NORMAL_COMPLETION); diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c index a61a8a72f5d..d18827d5b0c 100644 --- a/sys/dev/usb/uvideo.c +++ b/sys/dev/usb/uvideo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvideo.c,v 1.210 2020/11/17 12:39:56 mglocker Exp $ */ +/* $OpenBSD: uvideo.c,v 1.211 2021/01/27 17:28:19 mglocker Exp $ */ /* * Copyright (c) 2008 Robert Nagy @@ -2685,7 +2685,7 @@ uvideo_dump_desc_config(struct uvideo_softc *sc, printf("bLength=%d\n", d->bLength); printf("bDescriptorType=0x%02x\n", d->bDescriptorType); printf("wTotalLength=%d\n", UGETW(d->wTotalLength)); - printf("bNumInterface=0x%02x\n", d->bNumInterface); + printf("bNumInterfaces=0x%02x\n", d->bNumInterfaces); printf("bConfigurationValue=0x%02x\n", d->bConfigurationValue); printf("iConfiguration=0x%02x\n", d->iConfiguration); printf("bmAttributes=0x%02x\n", d->bmAttributes); -- 2.20.1