diff options
author | damien <damien@FreeBSD.org> | 2005-07-08 19:19:06 +0000 |
---|---|---|
committer | damien <damien@FreeBSD.org> | 2005-07-08 19:19:06 +0000 |
commit | 4e6c852a1208b2429dad46083c4befb5cb764430 (patch) | |
tree | 6e781e7cf92354b215830ad66faad5bf8b4c073a /sys | |
parent | 9530c73e6ce3a932f627ed1a3166dabdf5685b53 (diff) | |
download | FreeBSD-src-4e6c852a1208b2429dad46083c4befb5cb764430.zip FreeBSD-src-4e6c852a1208b2429dad46083c4befb5cb764430.tar.gz |
Make sure that all the necessary USB endpoints are found during device
attachment.
Reviewed by: silby (mentor)
Approved by: re (scottl)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/if_ural.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/if_uralvar.h | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c index 3e60518..ee2348c 100644 --- a/sys/dev/usb/if_ural.c +++ b/sys/dev/usb/if_ural.c @@ -388,6 +388,7 @@ USB_ATTACH(ural) */ id = usbd_get_interface_descriptor(sc->sc_iface); + sc->sc_rx_no = sc->sc_tx_no = -1; for (i = 0; i < id->bNumEndpoints; i++) { ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); if (ed == NULL) { @@ -403,6 +404,10 @@ USB_ATTACH(ural) UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) sc->sc_tx_no = ed->bEndpointAddress; } + if (sc->sc_rx_no == -1 || sc->sc_tx_no == -1) { + printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + USB_ATTACH_ERROR_RETURN; + } mtx_init(&sc->sc_mtx, USBDEVNAME(sc->sc_dev), MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); diff --git a/sys/dev/usb/if_uralvar.h b/sys/dev/usb/if_uralvar.h index 634c3db..160ad0d 100644 --- a/sys/dev/usb/if_uralvar.h +++ b/sys/dev/usb/if_uralvar.h @@ -76,8 +76,8 @@ struct ural_softc { usbd_device_handle sc_udev; usbd_interface_handle sc_iface; - uint8_t sc_rx_no; - uint8_t sc_tx_no; + int sc_rx_no; + int sc_tx_no; uint32_t asic_rev; uint8_t rf_rev; |