usb: abort control data in/out on reset or when receiving another SETUP.

This removes the horrible timeout hack.
This commit is contained in:
Dario Nieuwenhuis
2022-04-06 03:14:22 +02:00
parent f6d11dfba5
commit 22a47aeeb2
3 changed files with 50 additions and 31 deletions

View File

@ -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;
}
}
}
}

View File

@ -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;