USB: how transmit more than wMaxPacketSize of bulk data in one submission ?

Hi fellows,

I'm confused about the different size aspects, when setting up a USB transmission. Here's a brief example of what I want:

bulk_size is 512 bytes (USB 2.0) (endpoint->wMaxPacketSize) data size is 1000 bytes

From LDD I learnt, that it should be possible to set up the URB so that all data are delivered in one bunch and the core parts between the submission and the completion callback do the division and transmissions in adequate blocks. So I want to hand over to the URB a buffer containing the 1000 bytes, and receive an alertion (completion callback handler), when all 1000 bytes are out.

To transmit 512 bytes, I would do this: ------------------------- urb = usb_alloc_urb(0,GFP_KERNEL); buf = usb_buffer_alloc (udev, bulk_size, GFP_KERNEL, &urb->transfer_dma); memcpy(buf,data,bulk_size); usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(..), buf, bulk_size, callback,dev); urb->transfer_buffer_length = bulk_size; usb_submit_urb(urb, GFP_KERNEL);

and then, in callback handler (or at least after that): usb_buffer_free(udev, bulk_size, buf, urb->transfer_dma); usb_free_urb(urb); ------------------------------ Please check the '?'s. What must be filled in? Are my guesses ok? urb = usb_alloc_urb(0,GFP_KERNEL); buf = usb_buffer_alloc (udev, ?data_size?, GFP_KERNEL, &urb->transfer_dma); memcpy(buf,data,?data_size?); usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(..), buf, ?data_size?, callback,dev); urb->transfer_buffer_length = ?bulk_size?; usb_submit_urb(urb, GFP_KERNEL);

and then, in callback handler (or at least after that): usb_buffer_free(udev, ?data_size?, buf, urb->transfer_dma); usb_free_urb(urb); ------------------------------ What happens after submission? First packet goes out. And then? Is the second packet (with the rest of the data) automatically set up and submitted internally, before the callback handler is launched? Or is any further action required from my side?

I'd appreciate, if anybody could shed some light onto this. Bernhard

Reply to
Bernhard Holzmayer
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.