aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 43e3f12..11caafe 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -104,6 +104,7 @@ enum DeviceState {
WaitForSettle(usize),
GetConfig,
SetConfig(u8),
+ SetProtocol,
SetIdle,
SetReport,
Running,
@@ -262,7 +263,28 @@ impl Device {
none,
)?;
- self.state = DeviceState::SetIdle
+ self.state = DeviceState::SetProtocol;
+ }
+
+ DeviceState::SetProtocol => {
+ if let Some(ref ep) = self.endpoints[0] {
+ host.control_transfer(
+ &mut self.ep0,
+ RequestType::from((
+ RequestDirection::HostToDevice,
+ RequestKind::Class,
+ RequestRecipient::Interface,
+ )),
+ RequestCode::SetInterface,
+ WValue::from((0, 0)),
+ u16::from(ep.interface_num),
+ None,
+ )?;
+
+ self.state = DeviceState::SetIdle;
+ } else {
+ return Err(TransferError::Permanent("no boot keyboard"));
+ }
}
DeviceState::SetIdle => {
@@ -278,7 +300,7 @@ impl Device {
0,
none,
)?;
- self.state = DeviceState::SetReport
+ self.state = DeviceState::SetReport;
}
DeviceState::SetReport => {