Allow wider range of USB maxPacketSize values #441
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is important for isochronous endpoints, which reserve bandwidth on the USB as opposed to bulk endpoints which use whatever bandwidth is available. Isochronous transfers on full-speed USB can have maximum packet sizes anywhere between 1B and 1023B (not just powers of 2), but for instance bulk ones need to be either 1B, 2B, ... 32B, or 64B.
I've opened rust-embedded-community/usb-device#71 in usb-device to propose checking for valid endpoint sizes there, since that code will be the same across all implementations.
(note the old
alloc_ep()
code made buffers at least 64B - I couldn't find a reason for that, and it seems to work fine for smaller ones)