-/* $OpenBSD: ugen.c,v 1.113 2021/01/28 12:50:28 mglocker Exp $ */
+/* $OpenBSD: ugen.c,v 1.114 2021/02/01 09:21:51 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 $ */
}
int
-ugen_set_interface(struct ugen_softc *sc, int ifaceidx, int altno)
+ugen_set_interface(struct ugen_softc *sc, int ifaceno, int altno)
{
struct usbd_interface *iface;
usb_config_descriptor_t *cdesc;
uint8_t endptno, endpt;
int dir, err;
- DPRINTFN(15, ("ugen_set_interface %d %d\n", ifaceidx, altno));
+ DPRINTFN(15, ("ugen_set_interface %d %d\n", ifaceno, altno));
cdesc = usbd_get_config_descriptor(sc->sc_udev);
- if (ifaceidx < 0 || ifaceidx >= cdesc->bNumInterfaces ||
- usbd_iface_claimed(sc->sc_udev, ifaceidx))
+ if (ifaceno < 0 || ifaceno >= cdesc->bNumInterfaces ||
+ usbd_iface_claimed(sc->sc_udev, ifaceno))
return (USBD_INVAL);
- err = usbd_device2interface_handle(sc->sc_udev, ifaceidx, &iface);
+ err = usbd_device2interface_handle(sc->sc_udev, ifaceno, &iface);
if (err)
return (err);
id = usbd_get_interface_descriptor(iface);
}
int
-ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx)
+ugen_get_alt_index(struct ugen_softc *sc, int ifaceno)
{
struct usbd_interface *iface;
usbd_status err;
- err = usbd_device2interface_handle(sc->sc_udev, ifaceidx, &iface);
+ err = usbd_device2interface_handle(sc->sc_udev, ifaceno, &iface);
if (err)
return (-1);
return (usbd_get_interface_altindex(iface));
-/* $OpenBSD: usb_subr.c,v 1.153 2021/01/27 17:28:19 mglocker Exp $ */
+/* $OpenBSD: usb_subr.c,v 1.154 2021/02/01 09:21:51 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 $ */
}
usb_interface_descriptor_t *
-usbd_find_idesc(usb_config_descriptor_t *cd, int ifaceidx, int altidx)
+usbd_find_idesc(usb_config_descriptor_t *cd, int ifaceno, int altno)
{
char *p = (char *)cd;
char *end = p + UGETW(cd->wTotalLength);
for (curidx = lastidx = -1; p < end; ) {
d = (usb_interface_descriptor_t *)p;
- DPRINTFN(4,("usbd_find_idesc: idx=%d(%d) altidx=%d(%d) len=%d "
- "type=%d\n",
- ifaceidx, curidx, altidx, curaidx,
+ DPRINTFN(4,("usbd_find_idesc: ifaceno=%d(%d) altno=%d(%d) "
+ "len=%d type=%d\n",
+ ifaceno, curidx, altno, curaidx,
d->bLength, d->bDescriptorType));
if (d->bLength == 0) /* bad descriptor */
break;
curaidx = 0;
} else
curaidx++;
- if (ifaceidx == curidx && altidx == curaidx)
+ if (ifaceno == curidx && altno == curaidx)
return (d);
}
}
}
usb_endpoint_descriptor_t *
-usbd_find_edesc(usb_config_descriptor_t *cd, int ifaceidx, int altidx,
+usbd_find_edesc(usb_config_descriptor_t *cd, int ifaceno, int altno,
int endptidx)
{
char *p = (char *)cd;
usb_endpoint_descriptor_t *e;
int curidx;
- d = usbd_find_idesc(cd, ifaceidx, altidx);
+ d = usbd_find_idesc(cd, ifaceno, altno);
if (d == NULL)
return (NULL);
if (endptidx >= d->bNumEndpoints) /* quick exit */
}
usbd_status
-usbd_fill_iface_data(struct usbd_device *dev, int ifaceidx, int altidx)
+usbd_fill_iface_data(struct usbd_device *dev, int ifaceno, int altno)
{
- struct usbd_interface *ifc = &dev->ifaces[ifaceidx];
+ struct usbd_interface *ifc = &dev->ifaces[ifaceno];
usb_interface_descriptor_t *idesc;
int nendpt;
- DPRINTFN(4,("%s: ifaceidx=%d altidx=%d\n", __func__, ifaceidx, altidx));
+ DPRINTFN(4,("%s: ifaceno=%d altno=%d\n", __func__, ifaceno, altno));
- idesc = usbd_find_idesc(dev->cdesc, ifaceidx, altidx);
+ idesc = usbd_find_idesc(dev->cdesc, ifaceno, altno);
if (idesc == NULL)
return (USBD_INVAL);
ifc->device = dev;
ifc->idesc = idesc;
- ifc->index = ifaceidx;
- ifc->altindex = altidx;
+ ifc->index = ifaceno;
+ ifc->altindex = altno;
ifc->endpoints = NULL;
ifc->priv = NULL;
LIST_INIT(&ifc->pipes);
-/* $OpenBSD: usbdi.c,v 1.108 2021/01/29 11:44:06 edd Exp $ */
+/* $OpenBSD: usbdi.c,v 1.109 2021/02/01 09:21:51 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 $ */
}
void
-usbd_claim_iface(struct usbd_device *dev, int ifaceidx)
+usbd_claim_iface(struct usbd_device *dev, int ifaceno)
{
- dev->ifaces[ifaceidx].claimed = 1;
+ dev->ifaces[ifaceno].claimed = 1;
}
int
-usbd_iface_claimed(struct usbd_device *dev, int ifaceidx)
+usbd_iface_claimed(struct usbd_device *dev, int ifaceno)
{
- return (dev->ifaces[ifaceidx].claimed);
+ return (dev->ifaces[ifaceno].claimed);
}
#ifdef USB_DEBUG
/* XXXX use altno */
usbd_status
-usbd_set_interface(struct usbd_interface *iface, int altidx)
+usbd_set_interface(struct usbd_interface *iface, int altno)
{
usb_device_request_t req;
usbd_status err;
endpoints = iface->endpoints;
nendpt = iface->nendpt;
- err = usbd_fill_iface_data(iface->device, iface->index, altidx);
+ err = usbd_fill_iface_data(iface->device, iface->index, altno);
if (err)
return (err);
-/* $OpenBSD: usbdi.h,v 1.70 2018/05/01 18:14:46 landry Exp $ */
+/* $OpenBSD: usbdi.h,v 1.71 2021/02/01 09:21:51 mglocker Exp $ */
/* $NetBSD: usbdi.h,v 1.62 2002/07/11 21:14:35 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $ */
usb_interface_descriptor_t *usbd_find_idesc(usb_config_descriptor_t *cd,
int iindex, int ano);
usb_endpoint_descriptor_t *usbd_find_edesc(usb_config_descriptor_t *cd,
- int ifaceidx, int altidx, int endptidx);
+ int ifaceno, int altno, int endptidx);
void usbd_dopoll(struct usbd_device *);
void usbd_set_polling(struct usbd_device *iface, int on);