fix: USB HID Keyboard raw report (#9473)

This commit is contained in:
Rodrigo Garcia 2024-04-10 05:54:31 -03:00 committed by GitHub
parent 858b107bdf
commit 8ceb4bacb2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)