From 8ceb4bacb2341030e2218e29dd068c1ff26803e5 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Wed, 10 Apr 2024 05:54:31 -0300 Subject: [PATCH] fix: USB HID Keyboard raw report (#9473) --- libraries/USB/src/USBHIDKeyboard.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/USB/src/USBHIDKeyboard.cpp b/libraries/USB/src/USBHIDKeyboard.cpp index df1c357174b..737191b017c 100644 --- a/libraries/USB/src/USBHIDKeyboard.cpp +++ b/libraries/USB/src/USBHIDKeyboard.cpp @@ -222,7 +222,7 @@ size_t USBHIDKeyboard::pressRaw(uint8_t k) uint8_t i; if (k >= 0xE0 && k < 0xE8) { // it's a modifier key - _keyReport.modifiers |= (1<<(k-0x80)); + _keyReport.modifiers |= (1<<(k-0xE0)); } else if (k && k < 0xA5) { // Add k to the key report only if it's not already present // and if there is an empty slot. @@ -253,7 +253,7 @@ size_t USBHIDKeyboard::releaseRaw(uint8_t k) uint8_t i; if (k >= 0xE0 && k < 0xE8) { // it's a modifier key - _keyReport.modifiers &= ~(1<<(k-0x80)); + _keyReport.modifiers &= ~(1<<(k-0xE0)); } else if (k && k < 0xA5) { // Test the key report to see if k is present. Clear it if it exists. // Check all positions in case the key is present more than once (which it shouldn't be)