More MSC work

This commit is contained in:
chemicstry
2023-02-17 01:30:45 +02:00
parent ab7e26a777
commit 9be45c3be9
14 changed files with 831 additions and 86 deletions

View File

@ -83,23 +83,17 @@ impl<'d, D: Driver<'d>, C: CommandSetHandler> BulkOnlyTransport<'d, D, C> {
}
async fn receive_control_block_wrapper(&mut self) -> CommandBlockWrapper {
let mut cbw_buf = [0u8; size_of::<CommandBlockWrapper>()];
let mut cbw_buf = [0u8; 64];
loop {
// CBW is always sent at a packet boundary and is a short packet of 31 bytes
match self.read_ep.read(&mut cbw_buf).await {
Ok(len) => {
if len != cbw_buf.len() {
error!("Invalid CBW length");
Ok(_) => match CommandBlockWrapper::from_bytes(&cbw_buf) {
Ok(cbw) => return cbw,
Err(e) => {
error!("Invalid CBW: {:?}", e);
}
match CommandBlockWrapper::from_bytes(&cbw_buf) {
Ok(cbw) => return cbw,
Err(e) => {
error!("Invalid CBW: {:?}", e);
}
}
}
},
Err(e) => match e {
EndpointError::BufferOverflow => {
error!("Host sent too long CBW");