On Mon, 04 Feb 2008 08:30:37 -0800, Alan Nisota <[EMAIL PROTECTED]> wrote:

> [...]  If I do 
> this using blocking reads, the device never sends any data back  It 
> appears to be waiting for multiple bulk request URBS in the queue.  This 
> apparently eliminates my ability to use libusb, so now I need to do the 
> same thing in kernel-space.

You can submit multiply outstanding URBs and reap them using usbfs.

> One thing I noticed is that endpoint 82 declares a max packet size of 
> 0x400 where I thought the largest allowed size for usb 2.0 is 0x200. 
> The requests from Windows also have a buffer size of 0x20000, but I 
> assume the driver is splitting that into smaller packets.
> 
> I get the babble error regardless of the read-size I specify for the URB 
> request.

Very interesting. The EHCI spec allows for 1024 maximum packet size
in clause 3.6.2. The USB spec allows 1024 byte isochronous payloads
in clause 5.6.3. However, as far as I understand, bulk transfers
are limited to 512 maximum packet size. What type is endpoint 82?

By the way, there's virtually no way for you use buffers this big
in Linux. You'll have to restrict yourself to 8KB and chain them
with multiply URBs. Otherwise, your driver won't be able to allocate
them due to fragmentation.

> I'm not sure whether I'm initializing something incorrectly, or if the 
> device is doing something odd.  So I'm wondering if there is a way to 
> see the raw data that got returned for the URB even though it had a 
> babble error (I seem to always get a 0 len result, so I assume the 
> EOVERFLOW nukes whatever data might have been sent).  this would help 
> determine where the problem lies.

Whatever is DMA-ed into the buffer is there, however if we set
actual_len to zero, most likely nothing was transferred.

> If it is useful, my read handler looks sort of like this:
>          urb = usb_alloc_urb(0, GFP_KERNEL);
>          buf = usb_buffer_alloc(dev->udev, readsize, GFP_KERNEL, 
> &urb->transfer_dma);
>          usb_fill_bulk_urb(urb, dev->udev,
>                            usb_rcvbulkpipe(dev->udev, 0x82),
>                            buf, readsize, skel_read_bulk_callback, dev);
>          urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
>          retval = usb_submit_urb(urb, GFP_KERNEL);
>       usb_free_urb(urb);

Allocating a buffer with usb_buffer_alloc makes no sense for high-
bandwidth transfers, please use normal kmalloc or get_free_page.

-- Pete
-
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to