aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2019-09-26 09:01:40 -0400
committerBrian Cully <bjc@kublai.com>2019-09-26 09:01:40 -0400
commit03bee9362134bf9c3d5f4579391a5ced00b689e4 (patch)
treecb5a2dccc0e837b9682655b8065e2ec0a32fc3d5 /src/lib.rs
parent4e8ce911eb4cb2d7fd283bce17b48ce222baf92a (diff)
downloadbootkbd-03bee9362134bf9c3d5f4579391a5ced00b689e4.tar.gz
bootkbd-03bee9362134bf9c3d5f4579391a5ced00b689e4.zip
Check if boot keyboard exist in steady state.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index a1357c7..703f431 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -334,15 +334,21 @@ impl Device {
}
DeviceState::Running => {
- let mut buf: [u8; 8] = [0; 8];
if let Some(ref mut ep) = self.endpoints[0] {
- match host.in_transfer(ep, &mut buf) {
- Err(TransferError::Permanent(msg)) => error!("reading report: {}", msg),
+ let mut b: [u8; 8] = [0; 8];
+ let buf = &mut b[..];
+ match host.in_transfer(ep, buf) {
+ Err(TransferError::Permanent(msg)) => {
+ error!("reading report: {}", msg);
+ return Err(TransferError::Permanent(msg));
+ }
Err(TransferError::Retry(_)) => return Ok(()),
Ok(_) => {
- callback(self.addr, &buf);
+ callback(self.addr, buf);
}
}
+ } else {
+ return Err(TransferError::Permanent("no boot keyboard"));
}
}
}