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) ...@@ -873,6 +873,9 @@ static int proc_submiturb(struct dev_state *ps, void __user *arg)
/* arbitrary limit */ /* arbitrary limit */
if (uurb.number_of_packets < 1 || uurb.number_of_packets > 128) if (uurb.number_of_packets < 1 || uurb.number_of_packets > 128)
return -EINVAL; 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; isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb.number_of_packets;
if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL))) if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
...@@ -898,6 +901,9 @@ static int proc_submiturb(struct dev_state *ps, void __user *arg) ...@@ -898,6 +901,9 @@ static int proc_submiturb(struct dev_state *ps, void __user *arg)
uurb.number_of_packets = 0; uurb.number_of_packets = 0;
if (!(ep_desc = usb_epnum_to_ep_desc(ps->dev, uurb.endpoint))) if (!(ep_desc = usb_epnum_to_ep_desc(ps->dev, uurb.endpoint)))
return -ENOENT; return -ENOENT;
if (ps->dev->speed == USB_SPEED_HIGH)
interval = 1 << min ((u8)15, ep_desc->bInterval - 1);
else
interval = ep_desc->bInterval; interval = ep_desc->bInterval;
if (uurb.buffer_length > 16384) if (uurb.buffer_length > 16384)
return -EINVAL; return -EINVAL;
......
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