Skip to content

Commit

Permalink
usb: fix enumeration issues by propagating buffer overflow error.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattthebaker committed Jun 6, 2024
1 parent dda58d6 commit c324f30
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions hal/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased Changes

- Fix USB enumeration issues with fast host controllers
- Allow configuring USB clock with `GenericClockController` on atsamd11
- fix samd51j not having i2s support
- remove i2s functionality for samd51g since it does not have it
Expand Down
4 changes: 2 additions & 2 deletions hal/src/peripherals/usb/d11/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ impl Inner {
let rxstp = bank.received_setup_interrupt();

if bank.is_ready() || rxstp {
let size = bank.read(buf);
let size = bank.read(buf)?;

if rxstp {
bank.clear_received_setup_interrupt();
Expand All @@ -907,7 +907,7 @@ impl Inner {
bank.clear_transfer_complete();
bank.set_ready(false);

size
Ok(size)
} else {
Err(UsbError::WouldBlock)
}
Expand Down
4 changes: 2 additions & 2 deletions hal/src/peripherals/usb/d5x/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ impl Inner {
let rxstp = bank.received_setup_interrupt();

if bank.is_ready() || rxstp {
let size = bank.read(buf);
let size = bank.read(buf)?;

if rxstp {
bank.clear_received_setup_interrupt();
Expand All @@ -850,7 +850,7 @@ impl Inner {
bank.clear_transfer_complete();
bank.set_ready(false);

size
Ok(size)
} else {
Err(UsbError::WouldBlock)
}
Expand Down

0 comments on commit c324f30

Please sign in to comment.