From 28bbfdc4c68f16863b8185f966a002eefe238311 Mon Sep 17 00:00:00 2001 From: "Ben Scholzen (DASPRiD)" Date: Wed, 27 Dec 2023 13:52:50 +0100 Subject: [PATCH] fix: send modifier keys before keycode, fixes macOS detection --- src/main.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.rs b/src/main.rs index a8a20eb..95a811f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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,