diff options
author | Brian Cully <bjc@kublai.com> | 2019-08-01 21:38:07 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2019-08-01 21:38:07 -0400 |
commit | de3e8606c3bc199dfe417d3737c37fc898dc0442 (patch) | |
tree | c8676a25685eaef3f6e2ec998158697f21d2430f /usbh/src/device.rs | |
parent | 0771a8d2466fb418b566846cfd165480760fd9ce (diff) | |
download | samd21-demo-de3e8606c3bc199dfe417d3737c37fc898dc0442.tar.gz samd21-demo-de3e8606c3bc199dfe417d3737c37fc898dc0442.zip |
Short-circuit out of NAK on interrupt pipes.
Don't bother retrying. NAK on an interrupt endpoint means there's no
data.
Diffstat (limited to 'usbh/src/device.rs')
-rw-r--r-- | usbh/src/device.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/usbh/src/device.rs b/usbh/src/device.rs index aba3919..fd5c1a1 100644 --- a/usbh/src/device.rs +++ b/usbh/src/device.rs @@ -302,7 +302,7 @@ impl Device { FSM::GetReport(0) => self.state = FSM::Steady, FSM::GetReport(count) => { - info!("+++ getting report {}", count); + debug!("+++ getting report {}", count); // For now, just do an IN transfer to see if we can // get some keyboard reports without further setup. @@ -324,12 +324,11 @@ impl Device { fn read_report(&mut self, pipe_table: &mut PipeTable, host: &mut usb::HOST, id: u8) { if let Some(ref mut ep) = self.endpoints[id as usize] { let mut pipe = pipe_table.pipe_for(host, ep); - let mut buf: core::mem::MaybeUninit<[u8; 8]> = core::mem::MaybeUninit::uninit(); + let mut buf: [u8; 8] = [0; 8]; match pipe.in_transfer(ep, &mut buf, 15, self.millis) { - Ok(bytes_received) => { - let tmp = unsafe { &(buf.assume_init())[..bytes_received] }; - info!("report {}: {:?}", id, tmp); - } + Ok(bytes_received) => info!("report {}: {} - {:?}", id, bytes_received, buf), + + Err(PipeErr::Flow) => return, Err(e) => trace!("error {}: {:?}", id, e), } |