]> xenbits.xensource.com Git - seabios.git/commitdiff
usb: USB 3 devices encode bMaxPacketSize0 field.
authorKevin O'Connor <kevin@koconnor.net>
Fri, 24 Jan 2014 19:34:00 +0000 (14:34 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 29 Jan 2014 17:57:01 +0000 (12:57 -0500)
A USB 3 device uses an exponential encoding of the max packet size for
the default end point.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/hw/usb.c

index 8ffddf8833d9ca0c1ab27a5608190d07be8dc986..ff20b6cffc3fd1cc9eb5a9ebf0c04bf1b6ff4ecf 100644 (file)
@@ -319,13 +319,16 @@ configure_usb_device(struct usbdevice_s *usbdev)
     int ret = get_device_info8(usbdev->defpipe, &dinfo);
     if (ret)
         return 0;
-    dprintf(3, "device rev=%04x cls=%02x sub=%02x proto=%02x size=%02x\n"
+    u16 maxpacket = dinfo.bMaxPacketSize0;
+    if (dinfo.bcdUSB >= 0x0300)
+        maxpacket = 1 << dinfo.bMaxPacketSize0;
+    dprintf(3, "device rev=%04x cls=%02x sub=%02x proto=%02x size=%d\n"
             , dinfo.bcdUSB, dinfo.bDeviceClass, dinfo.bDeviceSubClass
-            , dinfo.bDeviceProtocol, dinfo.bMaxPacketSize0);
-    if (dinfo.bMaxPacketSize0 < 8 || dinfo.bMaxPacketSize0 > 64)
+            , dinfo.bDeviceProtocol, maxpacket);
+    if (maxpacket < 8)
         return 0;
     struct usb_endpoint_descriptor epdesc = {
-        .wMaxPacketSize = dinfo.bMaxPacketSize0,
+        .wMaxPacketSize = maxpacket,
         .bmAttributes = USB_ENDPOINT_XFER_CONTROL,
     };
     usbdev->defpipe = usb_update_pipe(usbdev, usbdev->defpipe, &epdesc);