aboutsummaryrefslogtreecommitdiff
path: root/embassy-usb/src
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-04-06 03:14:22 +0200
committerDario Nieuwenhuis <[email protected]>2022-04-06 05:38:11 +0200
commit22a47aeeb2bc9d459a6e83414632890164a7b448 (patch)
tree294dac5c31fa1e46a88314e95d3dd5feeba4d20e /embassy-usb/src
parentf6d11dfba56b2b04868e87a14d10395e1916306d (diff)
usb: abort control data in/out on reset or when receiving another SETUP.
This removes the horrible timeout hack.
Diffstat (limited to 'embassy-usb/src')
-rw-r--r--embassy-usb/src/control.rs8
-rw-r--r--embassy-usb/src/driver.rs2
2 files changed, 8 insertions, 2 deletions
diff --git a/embassy-usb/src/control.rs b/embassy-usb/src/control.rs
index b15ba4463..7c46812bd 100644
--- a/embassy-usb/src/control.rs
+++ b/embassy-usb/src/control.rs
@@ -295,7 +295,13 @@ impl<C: driver::ControlPipe> ControlPipe<C> {
295 .chain(need_zlp.then(|| -> &[u8] { &[] })); 295 .chain(need_zlp.then(|| -> &[u8] { &[] }));
296 296
297 while let Some(chunk) = chunks.next() { 297 while let Some(chunk) = chunks.next() {
298 self.control.data_in(chunk, chunks.size_hint().0 == 0).await; 298 match self.control.data_in(chunk, chunks.size_hint().0 == 0).await {
299 Ok(()) => {}
300 Err(e) => {
301 warn!("control accept_in failed: {:?}", e);
302 return;
303 }
304 }
299 } 305 }
300 } 306 }
301 307
diff --git a/embassy-usb/src/driver.rs b/embassy-usb/src/driver.rs
index 6eaa40b0d..d3231cb45 100644
--- a/embassy-usb/src/driver.rs
+++ b/embassy-usb/src/driver.rs
@@ -147,7 +147,7 @@ pub trait ControlPipe {
147 type DataOutFuture<'a>: Future<Output = Result<usize, ReadError>> + 'a 147 type DataOutFuture<'a>: Future<Output = Result<usize, ReadError>> + 'a
148 where 148 where
149 Self: 'a; 149 Self: 'a;
150 type DataInFuture<'a>: Future<Output = ()> + 'a 150 type DataInFuture<'a>: Future<Output = Result<(), WriteError>> + 'a
151 where 151 where
152 Self: 'a; 152 Self: 'a;
153 153