Skip to content

Commit

Permalink
Reduce interrupt endpoint bInterval to 1ms polling
Browse files Browse the repository at this point in the history
High-speed hosts compute bInterval differently. From my understanding,
this commit should result in a 1ms polling interval. The formula is

  Interval in microseconds = (2 ^ (bInterval - 1)) * 125us

This might resolve a contributor's observed warning during enumeration
(shown below). I was able to reproduce a similar warning on my own
system.

  [14381.332880] usb 1-4: config 1 interface 0 altsetting 0 endpoint
  0x81 has an invalid bInterval 255, changing to 11

That "changing to 11" results in a 128ms polling interval. I'm curious
if that's too slow.
  • Loading branch information
mciantyre committed Mar 4, 2023
1 parent a986c83 commit 80dec6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cdc_acm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl<B: UsbBus> CdcAcmClass<'_, B> {
pub fn new(alloc: &UsbBusAllocator<B>, max_packet_size: u16) -> CdcAcmClass<'_, B> {
CdcAcmClass {
comm_if: alloc.interface(),
comm_ep: alloc.interrupt(8, 255),
comm_ep: alloc.interrupt(8, 4),
data_if: alloc.interface(),
read_ep: alloc.bulk(max_packet_size),
write_ep: alloc.bulk(max_packet_size),
Expand Down

0 comments on commit 80dec6f

Please sign in to comment.