9

With one read() or write() at a time, can we increase the bulk data size over USB interface? For example, I want to transfer chunk of 1024 (1K) bytes data and if the device has limitations of only 64bytes, is there any way I can increase the packet size for read() and write() system call over USB?

Is there any limitation on size of data transfer over USB in a host->device environment?

1
  • Wouldn't this question have been better suited to StackOverflow?
    – cp.engr
    Jan 18, 2017 at 17:10

3 Answers 3

10

At the USB bus level packet sizes are restricted by the USB Specifications — restrictions for USB 2.0 are:

  • for bulk transfers — 512 bytes for high-speed endpoints, 8, 16, 32, or 64 bytes for full-speed endpoints (and low-speed bulk endpoints are not allowed at all);
  • for interrupt transfers — up to 1024 bytes for high-speed, up to 64 bytes for full-speed, up to 8 bytes for low-speed;
  • for isochronous transfers — up to 1024 bytes for high-speed, up to 1023 bytes for full-speed (and low-speed is not allowed again).

However, restrictions for read() and write() can be different due to buffering done by kernel drivers; e.g., when using usbfs with current Linux versions, up to 16384 bytes can be transferred with one system call.

2
  • usbfs now limits transfer size to just shy of 2GiB.. What the underlying kernel infrastructure can actually deliver is another question. Mar 29, 2016 at 14:07
  • @goertzenator, this answer is referring to packet sizes, not transfer sizes. Briefly, in USB, transfers consist of multiple packets. It's not clear to me which the OP is asking about.
    – cp.engr
    Jan 18, 2017 at 17:11
4

I'm not a USB protocol engineer but this document from the Intel EHCI USB Specification seems to suggest that the largest USB packet size that is allowable is 1024 bytes and the largest block of data that can be transferred in one go is 24576 bytes, as on page 35:

Seven page pointers are provided to support the expression of 8 isochronous transfers. The seven pointers allow for 3 (transactions) * 1024 (maximum packet size) * 8 (transaction records) (24576 bytes) to be moved with this data structure

-1

No, I believe it is dependent on the cluster size of the drive. You can define that through formatting.

1
  • 2
    the idea that a filesystem formatting choice has any influence over the link capabilities of a USB mass storage device doesn't make any sense to me. the underlying device structure might affect link capabilities, but not the particulars of a filesystem. but i think any limitation is in the USB data protocol (or drivers' interface to it). Mar 25, 2010 at 7:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .