summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/umct.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/usb/umct.c b/sys/dev/usb/umct.c
index 6739be85ac2..045d89e3f4e 100644
--- a/sys/dev/usb/umct.c
+++ b/sys/dev/usb/umct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: umct.c,v 1.11 2004/07/08 22:18:44 deraadt Exp $ */
+/* $OpenBSD: umct.c,v 1.12 2004/07/11 07:39:38 deraadt Exp $ */
/* $NetBSD: umct.c,v 1.10 2003/02/23 04:20:07 simonb Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -178,7 +178,7 @@ USB_ATTACH(umct)
char devinfo[1024];
char *devname = USBDEVNAME(sc->sc_dev);
usbd_status err;
- int i, found;
+ int i;
struct ucom_attach_args uca;
usbd_devinfo(dev, 0, devinfo, sizeof devinfo);
@@ -228,7 +228,6 @@ USB_ATTACH(umct)
id = usbd_get_interface_descriptor(sc->sc_iface);
sc->sc_iface_number = id->bInterfaceNumber;
- found = 0;
for (i = 0; i < id->bNumEndpoints; i++) {
ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i);
@@ -239,11 +238,15 @@ USB_ATTACH(umct)
USB_ATTACH_ERROR_RETURN;
}
+ /*
+ * The Bulkin endpoint is marked as an interrupt. Since
+ * we can't rely on the endpoint descriptor order, we'll
+ * check the wMaxPacketSize field to differentiate.
+ */
if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT &&
- found == 0) {
+ UGETW(ed->wMaxPacketSize) != 0x2) {
uca.bulkin = ed->bEndpointAddress;
- found = 1;
} else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT &&
UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
uca.bulkout = ed->bEndpointAddress;