Skip to content

Commit 7aa2d30

Browse files
committed
core: Fix for disabling NKRO in Boot protocol
1 parent 95651fd commit 7aa2d30

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

common/action_util.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void send_keyboard_report(void) {
7676
void add_key(uint8_t key)
7777
{
7878
#ifdef NKRO_ENABLE
79-
if (keyboard_nkro) {
79+
if (keyboard_protocol && keyboard_nkro) {
8080
add_key_bit(key);
8181
return;
8282
}
@@ -87,7 +87,7 @@ void add_key(uint8_t key)
8787
void del_key(uint8_t key)
8888
{
8989
#ifdef NKRO_ENABLE
90-
if (keyboard_nkro) {
90+
if (keyboard_protocol && keyboard_nkro) {
9191
del_key_bit(key);
9292
return;
9393
}
@@ -160,7 +160,7 @@ uint8_t has_anymod(void)
160160
uint8_t get_first_key(void)
161161
{
162162
#ifdef NKRO_ENABLE
163-
if (keyboard_nkro) {
163+
if (keyboard_protocol && keyboard_nkro) {
164164
uint8_t i = 0;
165165
for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
166166
;

common/command.c

+1
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ static bool command_common(uint8_t code)
315315
print_val_hex8(host_keyboard_leds());
316316
print_val_hex8(keyboard_protocol);
317317
print_val_hex8(keyboard_idle);
318+
print_val_hex8(keyboard_nkro);
318319
print_val_hex32(timer_count);
319320

320321
#ifdef PROTOCOL_PJRC

protocol/lufa/lufa.c

+3-5
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "lufa.h"
5454

5555
uint8_t keyboard_idle = 0;
56+
/* 0: Boot Protocol, 1: Report Protocol(default) */
5657
uint8_t keyboard_protocol = 1;
5758
static uint8_t keyboard_led_stats = 0;
5859

@@ -349,10 +350,7 @@ void EVENT_USB_Device_ControlRequest(void)
349350
Endpoint_ClearSETUP();
350351
Endpoint_ClearStatusStage();
351352

352-
keyboard_protocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00);
353-
#ifdef NKRO_ENABLE
354-
keyboard_nkro = !!keyboard_protocol;
355-
#endif
353+
keyboard_protocol = (USB_ControlRequest.wValue & 0xFF);
356354
clear_keyboard();
357355
}
358356
}
@@ -399,7 +397,7 @@ static void send_keyboard(report_keyboard_t *report)
399397

400398
/* Select the Keyboard Report Endpoint */
401399
#ifdef NKRO_ENABLE
402-
if (keyboard_nkro) {
400+
if (keyboard_protocol && keyboard_nkro) {
403401
/* Report protocol - NKRO */
404402
Endpoint_SelectEndpoint(NKRO_IN_EPNUM);
405403

0 commit comments

Comments
 (0)