Skip to content

Commit

Permalink
Handle SET_IDLE in hid, fix #28
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Aug 27, 2023
1 parent 4148f91 commit 5653003
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/hid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ impl UsbInterfaceHandler for UsbHidKeyboardHandler {
setup: SetupPacket,
_req: &[u8],
) -> Result<Vec<u8>> {
use StandardRequest::*;
if ep.is_ep0() {
// control transfers
match (setup.request_type, FromPrimitive::from_u8(setup.request)) {
(0b10000001, Some(GetDescriptor)) => {
match (setup.request_type, setup.request) {
(0b10000001, 0x06) => {
// GET_DESCRIPTOR
// high byte: type
match FromPrimitive::from_u16(setup.value >> 8) {
Some(HidDescriptorType::Report) => {
Expand All @@ -106,6 +106,10 @@ impl UsbInterfaceHandler for UsbHidKeyboardHandler {
_ => unimplemented!("hid descriptor {:?}", setup),
}
}
(0b00100001, 0x0A) => {
// SET_IDLE
return Ok(vec![]);
}
_ => unimplemented!("hid request {:?}", setup),
}
} else {
Expand Down

0 comments on commit 5653003

Please sign in to comment.