diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/ohci.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/ohcivar.h | 3 | ||||
-rw-r--r-- | sys/dev/usb/ugen.c | 84 | ||||
-rw-r--r-- | sys/dev/usb/uhid.c | 19 | ||||
-rw-r--r-- | sys/dev/usb/usb.c | 15 | ||||
-rw-r--r-- | sys/dev/usb/usb.h | 98 | ||||
-rw-r--r-- | sys/dev/usb/usb_subr.c | 44 | ||||
-rw-r--r-- | sys/dev/usb/usbdi.c | 4 |
8 files changed, 149 insertions, 133 deletions
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index c9d38044caa..c1e83997e64 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ohci.c,v 1.25 2002/03/14 03:16:08 millert Exp $ */ +/* $OpenBSD: ohci.c,v 1.26 2002/05/02 20:08:04 nate Exp $ */ /* $NetBSD: ohci.c,v 1.104 2001/09/28 23:57:21 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ @@ -205,6 +205,7 @@ Static int ohci_str(usb_string_descriptor_t *, int, char *); Static void ohci_timeout(void *); Static void ohci_rhsc_able(ohci_softc_t *, int); +Static void ohci_rhsc_enable(void *sc); Static void ohci_close_pipe(usbd_pipe_handle, ohci_soft_ed_t *); Static void ohci_abort_xfer(usbd_xfer_handle, usbd_status); @@ -636,6 +637,15 @@ ohci_free_sitd(ohci_softc_t *sc, ohci_soft_itd_t *sitd) splx(s); } +void +ohci_reset(ohci_softc_t *sc) +{ + ohci_shutdown(sc); + /* disable all interrupts and then switch on all desired + interrupts */ + OWRITE4(sc, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS); +} + usbd_status ohci_init(ohci_softc_t *sc) { @@ -861,6 +871,9 @@ ohci_init(ohci_softc_t *sc) sc->sc_powerhook = powerhook_establish(ohci_power, sc); sc->sc_shutdownhook = shutdownhook_establish(ohci_shutdown, sc); #endif +#if defined(__OpenBSD__) + timeout_set(&sc->sc_tmo_rhsc, ohci_rhsc_enable, sc); +#endif return (USBD_NORMAL_COMPLETION); diff --git a/sys/dev/usb/ohcivar.h b/sys/dev/usb/ohcivar.h index f1ff5a6946e..79b11e59168 100644 --- a/sys/dev/usb/ohcivar.h +++ b/sys/dev/usb/ohcivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ohcivar.h,v 1.14 2001/10/31 04:24:44 nate Exp $ */ +/* $OpenBSD: ohcivar.h,v 1.15 2002/05/02 20:08:04 nate Exp $ */ /* $NetBSD: ohcivar.h,v 1.28 2001/09/28 23:57:21 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohcivar.h,v 1.13 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -138,6 +138,7 @@ typedef struct ohci_softc { char sc_dying; } ohci_softc_t; +void ohci_reset(ohci_softc_t *); usbd_status ohci_init(ohci_softc_t *); int ohci_intr(void *); #if defined(__NetBSD__) || defined(__OpenBSD__) diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index 0d5b04d8195..8052edd6834 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ugen.c,v 1.17 2001/10/31 04:24:44 nate Exp $ */ +/* $OpenBSD: ugen.c,v 1.18 2002/05/02 20:08:04 nate Exp $ */ /* $NetBSD: ugen.c,v 1.49 2001/10/24 22:31:04 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/ugen.c,v 1.26 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -1064,37 +1064,37 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, case USB_GET_ALTINTERFACE: ai = (struct usb_alt_interface *)addr; err = usbd_device2interface_handle(sc->sc_udev, - ai->interface_index, &iface); + ai->uai_interface_index, &iface); if (err) return (EINVAL); idesc = usbd_get_interface_descriptor(iface); if (idesc == NULL) return (EIO); - ai->alt_no = idesc->bAlternateSetting; + ai->uai_alt_no = idesc->bAlternateSetting; break; case USB_SET_ALTINTERFACE: if (!(flag & FWRITE)) return (EPERM); ai = (struct usb_alt_interface *)addr; err = usbd_device2interface_handle(sc->sc_udev, - ai->interface_index, &iface); + ai->uai_interface_index, &iface); if (err) return (EINVAL); - err = ugen_set_interface(sc, ai->interface_index, ai->alt_no); + err = ugen_set_interface(sc, ai->uai_interface_index, ai->uai_alt_no); if (err) return (EINVAL); break; case USB_GET_NO_ALT: ai = (struct usb_alt_interface *)addr; - cdesc = ugen_get_cdesc(sc, ai->config_index, 0); + cdesc = ugen_get_cdesc(sc, ai->uai_config_index, 0); if (cdesc == NULL) return (EINVAL); - idesc = usbd_find_idesc(cdesc, ai->interface_index, 0); + idesc = usbd_find_idesc(cdesc, ai->uai_interface_index, 0); if (idesc == NULL) { free(cdesc, M_TEMP); return (EINVAL); } - ai->alt_no = usbd_get_no_alts(cdesc, idesc->bInterfaceNumber); + ai->uai_alt_no = usbd_get_no_alts(cdesc, idesc->bInterfaceNumber); free(cdesc, M_TEMP); break; case USB_GET_DEVICE_DESC: @@ -1103,47 +1103,47 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, break; case USB_GET_CONFIG_DESC: cd = (struct usb_config_desc *)addr; - cdesc = ugen_get_cdesc(sc, cd->config_index, 0); + cdesc = ugen_get_cdesc(sc, cd->ucd_config_index, 0); if (cdesc == NULL) return (EINVAL); - cd->desc = *cdesc; + cd->ucd_desc = *cdesc; free(cdesc, M_TEMP); break; case USB_GET_INTERFACE_DESC: id = (struct usb_interface_desc *)addr; - cdesc = ugen_get_cdesc(sc, id->config_index, 0); + cdesc = ugen_get_cdesc(sc, id->uid_config_index, 0); if (cdesc == NULL) return (EINVAL); - if (id->config_index == USB_CURRENT_CONFIG_INDEX && - id->alt_index == USB_CURRENT_ALT_INDEX) - alt = ugen_get_alt_index(sc, id->interface_index); + if (id->uid_config_index == USB_CURRENT_CONFIG_INDEX && + id->uid_alt_index == USB_CURRENT_ALT_INDEX) + alt = ugen_get_alt_index(sc, id->uid_interface_index); else - alt = id->alt_index; - idesc = usbd_find_idesc(cdesc, id->interface_index, alt); + alt = id->uid_alt_index; + idesc = usbd_find_idesc(cdesc, id->uid_interface_index, alt); if (idesc == NULL) { free(cdesc, M_TEMP); return (EINVAL); } - id->desc = *idesc; + id->uid_desc = *idesc; free(cdesc, M_TEMP); break; case USB_GET_ENDPOINT_DESC: ed = (struct usb_endpoint_desc *)addr; - cdesc = ugen_get_cdesc(sc, ed->config_index, 0); + cdesc = ugen_get_cdesc(sc, ed->ued_config_index, 0); if (cdesc == NULL) return (EINVAL); - if (ed->config_index == USB_CURRENT_CONFIG_INDEX && - ed->alt_index == USB_CURRENT_ALT_INDEX) - alt = ugen_get_alt_index(sc, ed->interface_index); + if (ed->ued_config_index == USB_CURRENT_CONFIG_INDEX && + ed->ued_alt_index == USB_CURRENT_ALT_INDEX) + alt = ugen_get_alt_index(sc, ed->ued_interface_index); else - alt = ed->alt_index; - edesc = usbd_find_edesc(cdesc, ed->interface_index, - alt, ed->endpoint_index); + alt = ed->ued_alt_index; + edesc = usbd_find_edesc(cdesc, ed->ued_interface_index, + alt, ed->ued_endpoint_index); if (edesc == NULL) { free(cdesc, M_TEMP); return (EINVAL); } - ed->desc = *edesc; + ed->ued_desc = *edesc; free(cdesc, M_TEMP); break; case USB_GET_FULL_DESC: @@ -1154,10 +1154,10 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, struct usb_full_desc *fd = (struct usb_full_desc *)addr; int error; - cdesc = ugen_get_cdesc(sc, fd->config_index, &len); - if (len > fd->size) - len = fd->size; - iov.iov_base = (caddr_t)fd->data; + cdesc = ugen_get_cdesc(sc, fd->ufd_config_index, &len); + if (len > fd->ufd_size) + len = fd->ufd_size; + iov.iov_base = (caddr_t)fd->ufd_data; iov.iov_len = len; uio.uio_iov = &iov; uio.uio_iovcnt = 1; @@ -1172,15 +1172,15 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, } case USB_GET_STRING_DESC: si = (struct usb_string_desc *)addr; - err = usbd_get_string_desc(sc->sc_udev, si->string_index, - si->language_id, &si->desc); + err = usbd_get_string_desc(sc->sc_udev, si->usd_string_index, + si->usd_language_id, &si->usd_desc); if (err) return (EINVAL); break; case USB_DO_REQUEST: { struct usb_ctl_request *ur = (void *)addr; - int len = UGETW(ur->request.wLength); + int len = UGETW(ur->ucr_request.wLength); struct iovec iov; struct uio uio; void *ptr = 0; @@ -1190,18 +1190,18 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, if (!(flag & FWRITE)) return (EPERM); /* Avoid requests that would damage the bus integrity. */ - if ((ur->request.bmRequestType == UT_WRITE_DEVICE && - ur->request.bRequest == UR_SET_ADDRESS) || - (ur->request.bmRequestType == UT_WRITE_DEVICE && - ur->request.bRequest == UR_SET_CONFIG) || - (ur->request.bmRequestType == UT_WRITE_INTERFACE && - ur->request.bRequest == UR_SET_INTERFACE)) + if ((ur->ucr_request.bmRequestType == UT_WRITE_DEVICE && + ur->ucr_request.bRequest == UR_SET_ADDRESS) || + (ur->ucr_request.bmRequestType == UT_WRITE_DEVICE && + ur->ucr_request.bRequest == UR_SET_CONFIG) || + (ur->ucr_request.bmRequestType == UT_WRITE_INTERFACE && + ur->ucr_request.bRequest == UR_SET_INTERFACE)) return (EINVAL); if (len < 0 || len > 32767) return (EINVAL); if (len != 0) { - iov.iov_base = (caddr_t)ur->data; + iov.iov_base = (caddr_t)ur->ucr_data; iov.iov_len = len; uio.uio_iov = &iov; uio.uio_iovcnt = 1; @@ -1209,7 +1209,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, uio.uio_offset = 0; uio.uio_segflg = UIO_USERSPACE; uio.uio_rw = - ur->request.bmRequestType & UT_READ ? + ur->ucr_request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_procp = p; ptr = malloc(len, M_TEMP, M_WAITOK); @@ -1219,8 +1219,8 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd, goto ret; } } - err = usbd_do_request_flags(sc->sc_udev, &ur->request, - ptr, ur->flags, &ur->actlen); + err = usbd_do_request_flags(sc->sc_udev, &ur->ucr_request, + ptr, ur->ucr_flags, &ur->ucr_actlen); if (err) { error = EIO; goto ret; diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index c2939df1bf9..fca9cd5d787 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhid.c,v 1.15 2001/10/31 04:24:44 nate Exp $ */ +/* $OpenBSD: uhid.c,v 1.16 2002/05/02 20:08:04 nate Exp $ */ /* $NetBSD: uhid.c,v 1.45 2001/10/26 17:58:21 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhid.c,v 1.22 1999/11/17 22:33:43 n_hibma Exp $ */ @@ -612,9 +612,9 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, caddr_t addr, case USB_GET_REPORT_DESC: rd = (struct usb_ctl_report_desc *)addr; - size = min(sc->sc_repdesc_size, sizeof rd->data); - rd->size = size; - memcpy(rd->data, sc->sc_repdesc, size); + size = min(sc->sc_repdesc_size, sizeof rd->ucrd_data); + rd->ucrd_size = size; + memcpy(rd->ucrd_data, sc->sc_repdesc, size); break; case USB_SET_IMMED: @@ -632,7 +632,7 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, caddr_t addr, case USB_GET_REPORT: re = (struct usb_ctl_report *)addr; - switch (re->report) { + switch (re->ucr_report) { case UHID_INPUT_REPORT: size = sc->sc_isize; id = sc->sc_iid; @@ -648,15 +648,15 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, caddr_t addr, default: return (EINVAL); } - err = usbd_get_report(sc->sc_iface, re->report, id, re->data, - size); + err = usbd_get_report(sc->sc_iface, re->ucr_report, id, + re->ucr_data, size); if (err) return (EIO); break; case USB_SET_REPORT: re = (struct usb_ctl_report *)addr; - switch (re->report) { + switch (re->ucr_report) { case UHID_INPUT_REPORT: size = sc->sc_isize; id = sc->sc_iid; @@ -672,7 +672,8 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, caddr_t addr, default: return (EINVAL); } - err = usbd_set_report(sc->sc_iface, re->report, id, re->data, + err = usbd_set_report(sc->sc_iface, re->ucr_report, id, + re->ucr_data, size); if (err) return (EIO); diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 8ddd9a61740..03e769920d3 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.c,v 1.16 2001/10/31 04:24:44 nate Exp $ */ +/* $OpenBSD: usb.c,v 1.17 2002/05/02 20:08:04 nate Exp $ */ /* $NetBSD: usb.c,v 1.53 2001/01/23 17:04:30 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb.c,v 1.20 1999/11/17 22:33:46 n_hibma Exp $ */ @@ -413,11 +413,11 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, struct proc *p) case USB_REQUEST: { struct usb_ctl_request *ur = (void *)data; - int len = UGETW(ur->request.wLength); + int len = UGETW(ur->ucr_request.wLength); struct iovec iov; struct uio uio; void *ptr = 0; - int addr = ur->addr; + int addr = ur->ucr_addr; usbd_status err; int error = 0; @@ -428,7 +428,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, struct proc *p) sc->sc_bus->devices[addr] == 0) return (EINVAL); if (len != 0) { - iov.iov_base = (caddr_t)ur->data; + iov.iov_base = (caddr_t)ur->ucr_data; iov.iov_len = len; uio.uio_iov = &iov; uio.uio_iovcnt = 1; @@ -436,7 +436,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, struct proc *p) uio.uio_offset = 0; uio.uio_segflg = UIO_USERSPACE; uio.uio_rw = - ur->request.bmRequestType & UT_READ ? + ur->ucr_request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_procp = p; ptr = malloc(len, M_TEMP, M_WAITOK); @@ -447,7 +447,8 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, struct proc *p) } } err = usbd_do_request_flags(sc->sc_bus->devices[addr], - &ur->request, ptr, ur->flags, &ur->actlen); + &ur->ucr_request, ptr, ur->ucr_flags, + &ur->ucr_actlen); if (err) { error = EIO; goto ret; @@ -468,7 +469,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, struct proc *p) case USB_DEVICEINFO: { struct usb_device_info *di = (void *)data; - int addr = di->addr; + int addr = di->udi_addr; usbd_device_handle dev; if (addr < 1 || addr >= USB_MAX_DEVICES) diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index 005f6f87472..0a3e39cfae3 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usb.h,v 1.14 2001/10/31 04:24:44 nate Exp $ */ +/* $OpenBSD: usb.h,v 1.15 2002/05/02 20:08:04 nate Exp $ */ /* $NetBSD: usb.h,v 1.52 2001/07/23 15:17:50 nathanw Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $ */ @@ -461,58 +461,58 @@ typedef struct { /*** ioctl() related stuff ***/ struct usb_ctl_request { - int addr; - usb_device_request_t request; - void *data; - int flags; + int ucr_addr; + usb_device_request_t ucr_request; + void *ucr_data; + int ucr_flags; #define USBD_SHORT_XFER_OK 0x04 /* allow short reads */ - int actlen; /* actual length transferred */ + int ucr_actlen; /* actual length transferred */ }; struct usb_alt_interface { - int config_index; - int interface_index; - int alt_no; + int uai_config_index; + int uai_interface_index; + int uai_alt_no; }; #define USB_CURRENT_CONFIG_INDEX (-1) #define USB_CURRENT_ALT_INDEX (-1) struct usb_config_desc { - int config_index; - usb_config_descriptor_t desc; + int ucd_config_index; + usb_config_descriptor_t ucd_desc; }; struct usb_interface_desc { - int config_index; - int interface_index; - int alt_index; - usb_interface_descriptor_t desc; + int uid_config_index; + int uid_interface_index; + int uid_alt_index; + usb_interface_descriptor_t uid_desc; }; struct usb_endpoint_desc { - int config_index; - int interface_index; - int alt_index; - int endpoint_index; - usb_endpoint_descriptor_t desc; + int ued_config_index; + int ued_interface_index; + int ued_alt_index; + int ued_endpoint_index; + usb_endpoint_descriptor_t ued_desc; }; struct usb_full_desc { - int config_index; - u_int size; - u_char *data; + int ufd_config_index; + u_int ufd_size; + u_char *ufd_data; }; struct usb_string_desc { - int string_index; - int language_id; - usb_string_descriptor_t desc; + int usd_string_index; + int usd_language_id; + usb_string_descriptor_t usd_desc; }; struct usb_ctl_report_desc { - int size; - u_char data[1024]; /* filled data size will vary */ + int ucrd_size; + u_char ucrd_data[1024]; /* filled data size will vary */ }; typedef struct { u_int32_t cookie; } usb_event_cookie_t; @@ -520,24 +520,24 @@ typedef struct { u_int32_t cookie; } usb_event_cookie_t; #define USB_MAX_DEVNAMES 4 #define USB_MAX_DEVNAMELEN 16 struct usb_device_info { - u_int8_t bus; - u_int8_t addr; /* device address */ - usb_event_cookie_t cookie; - char product[USB_MAX_STRING_LEN]; - char vendor[USB_MAX_STRING_LEN]; - char release[8]; - u_int16_t productNo; - u_int16_t vendorNo; - u_int16_t releaseNo; - u_int8_t class; - u_int8_t subclass; - u_int8_t protocol; - u_int8_t config; - u_int8_t lowspeed; - int power; /* power consumption in mA, 0 if selfpowered */ - int nports; - char devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN]; - u_int8_t ports[16];/* hub only: addresses of devices on ports */ + u_int8_t udi_bus; + u_int8_t udi_addr; /* device address */ + usb_event_cookie_t udi_cookie; + char udi_product[USB_MAX_STRING_LEN]; + char udi_vendor[USB_MAX_STRING_LEN]; + char udi_release[8]; + u_int16_t udi_productNo; + u_int16_t udi_vendorNo; + u_int16_t udi_releaseNo; + u_int8_t udi_class; + u_int8_t udi_subclass; + u_int8_t udi_protocol; + u_int8_t udi_config; + u_int8_t udi_lowspeed; + int udi_power; /* power consumption in mA, 0 if selfpowered */ + int udi_nports; + char udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN]; + u_int8_t udi_ports[16];/* hub only: addresses of devices on ports */ #define USB_PORT_ENABLED 0xff #define USB_PORT_SUSPENDED 0xfe #define USB_PORT_POWERED 0xfd @@ -545,12 +545,12 @@ struct usb_device_info { }; struct usb_ctl_report { - int report; - u_char data[1024]; /* filled data size will vary */ + int ucr_report; + u_char ucr_data[1024]; /* filled data size will vary */ }; struct usb_device_stats { - u_long requests[4]; /* indexed by transfer type UE_* */ + u_long uds_requests[4]; /* indexed by transfer type UE_* */ }; /* Events that can be read from /dev/usb */ diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 4a6953667f7..4883a38aa17 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.18 2001/10/31 04:24:44 nate Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.19 2002/05/02 20:08:04 nate Exp $ */ /* $NetBSD: usb_subr.c,v 1.87 2001/08/15 00:04:59 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -1190,37 +1190,37 @@ usbd_fill_deviceinfo(usbd_device_handle dev, struct usb_device_info *di, struct usbd_port *p; int i, err, s; - di->bus = USBDEVUNIT(dev->bus->bdev); - di->addr = dev->address; - di->cookie = dev->cookie; - usbd_devinfo_vp(dev, di->vendor, di->product, usedev); - usbd_printBCD(di->release, UGETW(dev->ddesc.bcdDevice)); - di->vendorNo = UGETW(dev->ddesc.idVendor); - di->productNo = UGETW(dev->ddesc.idProduct); - di->releaseNo = UGETW(dev->ddesc.bcdDevice); - di->class = dev->ddesc.bDeviceClass; - di->subclass = dev->ddesc.bDeviceSubClass; - di->protocol = dev->ddesc.bDeviceProtocol; - di->config = dev->config; - di->power = dev->self_powered ? 0 : dev->power; - di->lowspeed = dev->lowspeed; + di->udi_bus = USBDEVUNIT(dev->bus->bdev); + di->udi_addr = dev->address; + di->udi_cookie = dev->cookie; + usbd_devinfo_vp(dev, di->udi_vendor, di->udi_product, usedev); + usbd_printBCD(di->udi_release, UGETW(dev->ddesc.bcdDevice)); + di->udi_vendorNo = UGETW(dev->ddesc.idVendor); + di->udi_productNo = UGETW(dev->ddesc.idProduct); + di->udi_releaseNo = UGETW(dev->ddesc.bcdDevice); + di->udi_class = dev->ddesc.bDeviceClass; + di->udi_subclass = dev->ddesc.bDeviceSubClass; + di->udi_protocol = dev->ddesc.bDeviceProtocol; + di->udi_config = dev->config; + di->udi_power = dev->self_powered ? 0 : dev->power; + di->udi_lowspeed = dev->lowspeed; if (dev->subdevs != NULL) { for (i = 0; dev->subdevs[i] && i < USB_MAX_DEVNAMES; i++) { - strncpy(di->devnames[i], USBDEVPTRNAME(dev->subdevs[i]), + strncpy(di->udi_devnames[i], USBDEVPTRNAME(dev->subdevs[i]), USB_MAX_DEVNAMELEN); - di->devnames[i][USB_MAX_DEVNAMELEN-1] = '\0'; + di->udi_devnames[i][USB_MAX_DEVNAMELEN-1] = '\0'; } } else { i = 0; } for (/*i is set */; i < USB_MAX_DEVNAMES; i++) - di->devnames[i][0] = 0; /* empty */ + di->udi_devnames[i][0] = 0; /* empty */ if (dev->hub) { for (i = 0; - i < sizeof(di->ports) / sizeof(di->ports[0]) && + i < sizeof(di->udi_ports) / sizeof(di->udi_ports[0]) && i < dev->hub->hubdesc.bNbrPorts; i++) { p = &dev->hub->ports[i]; @@ -1237,11 +1237,11 @@ usbd_fill_deviceinfo(usbd_device_handle dev, struct usb_device_info *di, else err = USB_PORT_DISABLED; } - di->ports[i] = err; + di->udi_ports[i] = err; } - di->nports = dev->hub->hubdesc.bNbrPorts; + di->udi_nports = dev->hub->hubdesc.bNbrPorts; } else - di->nports = 0; + di->udi_nports = 0; } void diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index 932ed318765..002fa3767f5 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.c,v 1.15 2002/04/01 21:47:07 nate Exp $ */ +/* $OpenBSD: usbdi.c,v 1.16 2002/05/02 20:08:04 nate Exp $ */ /* $NetBSD: usbdi.c,v 1.81 2001/04/17 00:05:33 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */ @@ -765,7 +765,7 @@ usb_transfer_complete(usbd_xfer_handle xfer) repeat, SIMPLEQ_FIRST(&pipe->queue))); /* Count completed transfers. */ - ++pipe->device->bus->stats.requests + ++pipe->device->bus->stats.uds_requests [pipe->endpoint->edesc->bmAttributes & UE_XFERTYPE]; xfer->done = 1; |