svn commit: r240999 - head/sys/dev/usb/controller
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Sep 27 15:45:24 UTC 2012
Author: hselasky
Date: Thu Sep 27 15:45:24 2012
New Revision: 240999
URL: http://svn.freebsd.org/changeset/base/240999
Log:
Make sure the "wMaxPacketSize" limitations are respected.
Modified:
head/sys/dev/usb/controller/dwc_otg.c
Modified: head/sys/dev/usb/controller/dwc_otg.c
==============================================================================
--- head/sys/dev/usb/controller/dwc_otg.c Thu Sep 27 15:23:38 2012 (r240998)
+++ head/sys/dev/usb/controller/dwc_otg.c Thu Sep 27 15:45:24 2012 (r240999)
@@ -3974,9 +3974,34 @@ dwc_otg_ep_init(struct usb_device *udev,
return;
}
} else {
- if (udev->speed != USB_SPEED_LOW &&
- udev->speed != USB_SPEED_FULL &&
- udev->speed != USB_SPEED_HIGH) {
+ uint16_t mps;
+
+ mps = UGETW(edesc->wMaxPacketSize);
+
+ /* Apply limitations of our USB host driver */
+
+ switch (udev->speed) {
+ case USB_SPEED_HIGH:
+ if (mps > 512) {
+ DPRINTF("wMaxPacketSize=0x%04x"
+ "is not supported\n", (int)mps);
+ /* not supported */
+ return;
+ }
+ break;
+
+ case USB_SPEED_FULL:
+ case USB_SPEED_LOW:
+ if (mps > 188) {
+ DPRINTF("wMaxPacketSize=0x%04x"
+ "is not supported\n", (int)mps);
+ /* not supported */
+ return;
+ }
+ break;
+
+ default:
+ DPRINTF("Invalid device speed\n");
/* not supported */
return;
}
More information about the svn-src-head
mailing list