Commit 300871cd authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Greg Kroah-Hartman

USB: Fix up full-speed bInterval values in high-speed interrupt descriptor

Many device manufacturers are using full-speed bInterval values in high-speed
interrupt endpoint descriptors. If the bInterval value is greater than 16,
assume the device uses full-speed descriptors and fix the value accordingly.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@skynet.be>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 87d093e2
......@@ -85,14 +85,20 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
memcpy(&endpoint->desc, d, n);
INIT_LIST_HEAD(&endpoint->urb_list);
/* If the bInterval value is outside the legal range,
* set it to a default value: 32 ms */
/* Fix up bInterval values outside the legal range. Use 32 ms if no
* proper value can be guessed. */
i = 0; /* i = min, j = max, n = default */
j = 255;
if (usb_endpoint_xfer_int(d)) {
i = 1;
switch (to_usb_device(ddev)->speed) {
case USB_SPEED_HIGH:
/* Many device manufacturers are using full-speed
* bInterval values in high-speed interrupt endpoint
* descriptors. Try to fix those and fall back to a
* 32 ms default value otherwise. */
n = fls(d->bInterval*8);
if (n == 0)
n = 9; /* 32 ms = 2^(9-1) uframes */
j = 16;
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment