Skip to content

Commit

Permalink
fix: send modifier keys before keycode, fixes macOS detection
Browse files Browse the repository at this point in the history
  • Loading branch information
DASPRiD committed Dec 27, 2023
1 parent b754f5b commit 28bbfdc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,19 @@ async fn send_keypress<'a, I: embassy_rp::usb::Instance>(
keycode: u8,
modifier: u8,
) {
if modifier > 0 {
let report = KeyboardReport {
keycodes: [0, 0, 0, 0, 0, 0],
leds: 0,
modifier,
reserved: 0,
};
match writer.write_serialize(&report).await {
Ok(()) => {}
Err(e) => warn!("Failed to send report: {:?}", e),
};
}

let report = KeyboardReport {
keycodes: [keycode, 0, 0, 0, 0, 0],
leds: 0,
Expand Down

0 comments on commit 28bbfdc

Please sign in to comment.