USB: Fix usb_fill_int_urb for SuperSpeed and Wireless

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>

USB 3 and Wireless USB specify a logarithmic encoding of the endpoint
interval that matches the USB 2 specification.  usb_fill_int_urb()
didn't know that and was filling in the interval as if it was USB 1.1.
As noted in the updated comment, Wireless USB uses 128us instead of 125us,
but it's still logarithmic.

Signed-off-by: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>
Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>

diff --git a/include/linux/usb.h b/include/linux/usb.h
index 0940315..852104c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1320,9 +1320,11 @@ static inline void usb_fill_bulk_urb(struct urb *urb,
  *
  * Initializes a interrupt urb with the proper information needed to submit
  * it to a device.
- * Note that high speed interrupt endpoints use a logarithmic encoding of
- * the endpoint interval, and express polling intervals in microframes
- * (eight per millisecond) rather than in frames (one per millisecond).
+ * Note that high and super speed interrupt endpoints use a logarithmic
+ * encoding of the endpoint interval, and express polling intervals in
+ * microframes (eight per millisecond) rather than in frames (one per
+ * millisecond).  Wireless USB also uses the logarithmic encoding, but
+ * specifies it in units of 128us instead of 125us.
  */
 static inline void usb_fill_int_urb(struct urb *urb,
 				    struct usb_device *dev,
@@ -1339,10 +1341,10 @@ static inline void usb_fill_int_urb(struct urb *urb,
 	urb->transfer_buffer_length = buffer_length;
 	urb->complete = complete_fn;
 	urb->context = context;
-	if (dev->speed == USB_SPEED_HIGH)
-		urb->interval = 1 << (interval - 1);
-	else
+	if (dev->speed < USB_SPEED_HIGH)
 		urb->interval = interval;
+	else
+		urb->interval = 1 << (interval - 1);
 	urb->start_frame = -1;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux