diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2005-05-13 18:42:51 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2005-05-13 18:42:51 +0000 |
commit | f8a20b9c8a92bd163eff17653229922fc16724a2 (patch) | |
tree | 32e5744b37cfa99afe9544b317d24cd372b76f12 /sys | |
parent | 440b2eeb5a63fa047d04c99a9c3544e16bc554fa (diff) |
make sure all endpoint descriptors have been found during the attachment.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/usb/if_ral.c | 9 | ||||
-rw-r--r-- | sys/dev/usb/if_ralvar.h | 6 |
2 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c index d2994c6c81b..5e37b2c1918 100644 --- a/sys/dev/usb/if_ral.c +++ b/sys/dev/usb/if_ral.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ral.c,v 1.29 2005/05/13 18:17:08 damien Exp $ */ +/* $OpenBSD: if_ral.c,v 1.30 2005/05/13 18:42:50 damien Exp $ */ /*- * Copyright (c) 2005 @@ -373,10 +373,11 @@ 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) { - printf("%s: no endpoint descriptor for %d\n", + printf("%s: no endpoint descriptor for iface %d\n", USBDEVNAME(sc->sc_dev), i); USB_ATTACH_ERROR_RETURN; } @@ -388,6 +389,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; + } usb_init_task(&sc->sc_task, ural_task, sc); timeout_set(&sc->scan_ch, ural_next_scan, sc); diff --git a/sys/dev/usb/if_ralvar.h b/sys/dev/usb/if_ralvar.h index acbee13a967..9b553b20c41 100644 --- a/sys/dev/usb/if_ralvar.h +++ b/sys/dev/usb/if_ralvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ralvar.h,v 1.1 2005/03/16 20:17:10 damien Exp $ */ +/* $OpenBSD: if_ralvar.h,v 1.2 2005/05/13 18:42:50 damien Exp $ */ /*- * Copyright (c) 2005 @@ -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; |