Correct modifier flag removal logic. The previous logic was unlikely to break in production, but was technically incorrect, as it -could- actually add the flag. (XOR was the wrong construct to use when clearing a flag.)

Originally reported by Michael Richters <gedankenexperimenter@gmail.com>
 as https://github.com/keyboardio/Kaleidoscope-HIDAdaptor-KeyboardioHID/pull/15
pull/915/head
Jesse Vincent 4 years ago
parent 9511140e52
commit 4681589821
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -306,7 +306,7 @@ class Keyboard {
void releaseKey(Key released_key) {
// Remove any modifiers attached to this key from the bitmask of modifiers we're
// willing to attach to USB HID keyboard reports
modifier_flag_mask ^= released_key.getFlags();
modifier_flag_mask &= ~(released_key.getFlags());
if (!isModifierKey(released_key)) {
@ -445,7 +445,7 @@ class Keyboard {
// to the next USB HID report and removes them from the bitmap of all such modifiers.
void cancelModifierRequest(byte flags) {
requested_modifier_flags ^= flags;
requested_modifier_flags &= ~flags;
}
// pressModifiers takes a bitmap of modifier keys that must be included in

Loading…
Cancel
Save