diff options
author | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-04-06 03:14:22 +0200 |
---|---|---|
committer | Dario Nieuwenhuis <dirbaio@dirbaio.net> | 2022-04-06 05:38:11 +0200 |
commit | 22a47aeeb2bc9d459a6e83414632890164a7b448 (patch) | |
tree | 294dac5c31fa1e46a88314e95d3dd5feeba4d20e /embassy-usb | |
parent | f6d11dfba56b2b04868e87a14d10395e1916306d (diff) | |
download | embassy-22a47aeeb2bc9d459a6e83414632890164a7b448.zip |
usb: abort control data in/out on reset or when receiving another SETUP.
This removes the horrible timeout hack.
Diffstat (limited to 'embassy-usb')
-rw-r--r-- | embassy-usb/src/control.rs | 8 | ||||
-rw-r--r-- | embassy-usb/src/driver.rs | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/embassy-usb/src/control.rs b/embassy-usb/src/control.rs index b15ba446..7c46812b 100644 --- a/embassy-usb/src/control.rs +++ b/embassy-usb/src/control.rs @@ -295,7 +295,13 @@ impl<C: driver::ControlPipe> ControlPipe<C> { .chain(need_zlp.then(|| -> &[u8] { &[] })); while let Some(chunk) = chunks.next() { - self.control.data_in(chunk, chunks.size_hint().0 == 0).await; + match self.control.data_in(chunk, chunks.size_hint().0 == 0).await { + Ok(()) => {} + Err(e) => { + warn!("control accept_in failed: {:?}", e); + return; + } + } } } diff --git a/embassy-usb/src/driver.rs b/embassy-usb/src/driver.rs index 6eaa40b0..d3231cb4 100644 --- a/embassy-usb/src/driver.rs +++ b/embassy-usb/src/driver.rs @@ -147,7 +147,7 @@ pub trait ControlPipe { type DataOutFuture<'a>: Future<Output = Result<usize, ReadError>> + 'a where Self: 'a; - type DataInFuture<'a>: Future<Output = ()> + 'a + type DataInFuture<'a>: Future<Output = Result<(), WriteError>> + 'a where Self: 'a; |