diff options
| author | rumble <rumble@NetBSD.org> | 2004-07-08 00:54:21 +0000 |
|---|---|---|
| committer | rumble <rumble@NetBSD.org> | 2004-07-08 00:54:21 +0000 |
| commit | bbbaf17cc4e7b85de595f06a696daaaf7a71c300 (patch) | |
| tree | a242e40001ea729a0dd8458eb62c1d15404f96d0 /sys/dev | |
| parent | 18c8edba4d67e1e8a01748bd3523df26b61ad6c4 (diff) | |
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.
From FreeBSD's umct.c, ok'd by mycroft@, closes PR25959.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/umct.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/dev/usb/umct.c b/sys/dev/usb/umct.c index 7d09e70892d..c0e1c16547c 100644 --- a/sys/dev/usb/umct.c +++ b/sys/dev/usb/umct.c @@ -1,4 +1,4 @@ -/* $NetBSD: umct.c,v 1.13 2004/04/23 17:25:25 itojun Exp $ */ +/* $NetBSD: umct.c,v 1.14 2004/07/08 00:54:21 rumble Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: umct.c,v 1.13 2004/04/23 17:25:25 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: umct.c,v 1.14 2004/07/08 00:54:21 rumble Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -180,7 +180,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)); @@ -230,7 +230,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); @@ -241,11 +240,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; |
