-
Notifications
You must be signed in to change notification settings - Fork 145
usb_stream_helper requires the chunk buffer size to be a power of 2 #66
Copy link
Copy link
Open
Description
The asserts in the code indicate that that chunk_size must be a multiple of the usb packet size (64 bytes):
| assert(!(chunk_size & 63u)); // buffer should be a multiple of USB packet buffer size |
But in reality things break if the chunk_size is not also a power of 2 as the offset computation breaks down here:
| return transfer->offset & (transfer->chunk_size - 1); |
For example, if the chunk_size is 192 bytes the offset will not be updated after the first packet is sent, and so the first packet gets sent twice.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels