Skip to content

Commit

Permalink
unconditionally send boot report
Browse files Browse the repository at this point in the history
  • Loading branch information
tlyu committed Nov 26, 2023
1 parent 619c4d2 commit 0552b04
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
30 changes: 12 additions & 18 deletions src/kaleidoscope/driver/hid/base/Keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,15 @@ class Keyboard {
}

void sendReport() __attribute__((noinline)) {
if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) {
boot_keyboard_.sendReport();
return;
boot_keyboard_.sendReport();
if (boot_keyboard_.getProtocol() != HID_BOOT_PROTOCOL) {
nkro_keyboard_.sendReport();
consumer_control_.sendReport();
}
nkro_keyboard_.sendReport();
consumer_control_.sendReport();
}
void releaseAllKeys() __attribute__((noinline)) {
if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) {
boot_keyboard_.releaseAll();
} else {
boot_keyboard_.releaseAll();
if (boot_keyboard_.getProtocol() != HID_BOOT_PROTOCOL) {
nkro_keyboard_.releaseAll();
consumer_control_.releaseAll();
}
Expand Down Expand Up @@ -204,21 +202,17 @@ class Keyboard {
// pressRawKey takes a Key object and calles KeyboardioHID's ".press" method
// with its keycode. It does no processing of any flags or modifiers on the key
void pressRawKey(Key pressed_key) {
if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) {
boot_keyboard_.press(pressed_key.getKeyCode());
return;
boot_keyboard_.press(pressed_key.getKeyCode());
if (boot_keyboard_.getProtocol() != HID_BOOT_PROTOCOL) {
nkro_keyboard_.press(pressed_key.getKeyCode());
}

nkro_keyboard_.press(pressed_key.getKeyCode());
}

void releaseRawKey(Key released_key) {
if (boot_keyboard_.getProtocol() == HID_BOOT_PROTOCOL) {
boot_keyboard_.release(released_key.getKeyCode());
return;
boot_keyboard_.release(released_key.getKeyCode());
if (boot_keyboard_.getProtocol() != HID_BOOT_PROTOCOL) {
nkro_keyboard_.release(released_key.getKeyCode());
}

nkro_keyboard_.release(released_key.getKeyCode());
}

void releaseKey(Key released_key) {
Expand Down
5 changes: 5 additions & 0 deletions src/kaleidoscope/driver/hid/keyboardio/Keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
// From Kaleidoscope:
#include "kaleidoscope/driver/hid/base/Keyboard.h" // for Keyboard, KeyboardProps

#if !BOOTKB_AS_PADDING
#error "This version of Kaleidoscope requires KeyboardioHID with BOOTKB_AS_PADDING"
#error "Please update your KeyboardioHID"
#endif

namespace kaleidoscope {
namespace driver {
namespace hid {
Expand Down

0 comments on commit 0552b04

Please sign in to comment.