aboutsummaryrefslogtreecommitdiffstats
path: root/usbh
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2019-07-30 14:13:17 -0400
committerBrian Cully <bjc@kublai.com>2019-07-30 14:13:17 -0400
commitfb45c6c269bb1440fdf8750bed875dfe973ca8bb (patch)
treebb3add7a3a52d346bf58f60cbc3900f2bc3c75c7 /usbh
parenta932ef8ce392f1009e7c6975b195de8abd1c7f3b (diff)
downloadsamd21-demo-fb45c6c269bb1440fdf8750bed875dfe973ca8bb.tar.gz
samd21-demo-fb45c6c269bb1440fdf8750bed875dfe973ca8bb.zip
Only make three attempts to get the keyboard report.
I'm tired of the spam, and three should be enough.
Diffstat (limited to 'usbh')
-rw-r--r--usbh/src/device.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/usbh/src/device.rs b/usbh/src/device.rs
index e77c9ea..aaf82d1 100644
--- a/usbh/src/device.rs
+++ b/usbh/src/device.rs
@@ -34,6 +34,7 @@ enum FSM {
WaitForSettle(usize),
GetConfigDescriptor,
SetConfig,
+ GetReport(usize),
Steady,
}
@@ -239,10 +240,14 @@ impl Device {
)?;
debug!(" -- report set: {}", rep_res);
- self.state = FSM::Steady
+ self.state = FSM::GetReport(3)
}
- FSM::Steady => {
+ FSM::GetReport(0) => self.state = FSM::Steady,
+
+ FSM::GetReport(count) => {
+ info!("+++ getting report {}", count);
+
// For now, just do an IN transfer to see if we can
// get some keyboard reports without further setup.
@@ -261,7 +266,11 @@ impl Device {
//let mut pipe = pipe_table.pipe_for(host, self.addr, 2);
//pipe.regs.cfg.write(|w| unsafe { w.ptype().bits(0x4) });
//self.read_report(&mut pipe, 2);
+
+ self.state = FSM::GetReport(count - 1)
}
+
+ FSM::Steady => {}
}
Ok(())
}