Make sure that all the necessary USB endpoints are found during device

attachment.

Reviewed by:	silby (mentor)
Approved by:	re (scottl)
This commit is contained in:
damien 2005-07-08 19:19:06 +00:00
parent 9530c73e6c
commit 4e6c852a12
2 changed files with 7 additions and 2 deletions

View File

@ -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);

View File

@ -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;