diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-07-11 07:39:39 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-07-11 07:39:39 +0000 |
commit | ba4d9df6e92d74709ecf45dab532c848a9026fcb (patch) | |
tree | 701fcead233c6d1690eb68c9eda211831816bb67 /sys/dev | |
parent | 067cb39e231c333070b53ef28a0a70750c3abdae (diff) |
from freebsd via netbsd via loki
The MCT advertises both the interrupt and bulkin endpoints as
interrupts. Go from assuming that the first enumerated interrupt
is the bulkin (since this may not be the case) to assuming that
the true interrupt endpoint will have a 0x2 wMaxPacketSize.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/umct.c | 13 |
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; |