keyboardio / KeyboardioHID

A HID library for Arduino
MIT License
34 stars 17 forks source link

BootKeyboard: Fix modifier release #37

Closed algernon closed 6 years ago

algernon commented 6 years ago

When releasing a modifier, we were computing the bit index wrong: we substracted HID_KEYBOARD_LAST_MODIFIER from the keycode (going into negatives and wrapping around) instead of HID_KEYBOARD_FIRST_MODIFIER. Computing the index wrong meant that BootKeyboard.release(Key_LeftShift.keyCode) never cleared the shift bit from _keyReport.modifiers. This had undesired effects when BootKeyboard was active, and we explicitly wanted to release a single key, but keep the rest of the report intact.