ChangeSet 1.1371.759.1, 2004/04/23 14:48:02-07:00, [EMAIL PROTECTED]

[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.


 drivers/usb/core/devio.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)


diff -Nru a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
--- a/drivers/usb/core/devio.c  Fri May 14 15:34:47 2004
+++ b/drivers/usb/core/devio.c  Fri May 14 15:34:47 2004
@@ -873,6 +873,9 @@
                /* 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 @@
                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))



-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to