Commit 2aad220d authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: fix usbfs iso interval problem

In 2.6, ISO transfers on USB require a value for urb->interval ... which
usbfs didn't provide (until this patch), or let user mode drivers specify.

This patch initializes the urb->interval from the endpoint's descriptor,
so ISO transfers should now work from userspace.  It also fixes a related
problem for interrupt transfers.
parent 7ce42ae1
......@@ -873,6 +873,9 @@ static int proc_submiturb(struct dev_state *ps, void __user *arg)
/* arbitrary limit */
if (uurb.number_of_packets < 1 || uurb.number_of_packets > 128)
return -EINVAL;
if (!(ep_desc = usb_epnum_to_ep_desc(ps->dev, uurb.endpoint)))
return -ENOENT;
interval = 1 << min ((u8)15, ep_desc->bInterval - 1);
isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb.number_of_packets;
if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
return -ENOMEM;
......@@ -898,7 +901,10 @@ static int proc_submiturb(struct dev_state *ps, void __user *arg)
uurb.number_of_packets = 0;
if (!(ep_desc = usb_epnum_to_ep_desc(ps->dev, uurb.endpoint)))
return -ENOENT;
interval = ep_desc->bInterval;
if (ps->dev->speed == USB_SPEED_HIGH)
interval = 1 << min ((u8)15, ep_desc->bInterval - 1);
else
interval = ep_desc->bInterval;
if (uurb.buffer_length > 16384)
return -EINVAL;
if (!access_ok((uurb.endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb.buffer, uurb.buffer_length))
......
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