]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
core: Fix for disabling NKRO in Boot protocol
authortmk <hasu@tmk-kbd.com>
Sun, 20 Sep 2015 05:34:13 +0000 (14:34 +0900)
committertmk <hasu@tmk-kbd.com>
Sun, 20 Sep 2015 05:34:13 +0000 (14:34 +0900)
tmk_core/common/action_util.c
tmk_core/common/command.c
tmk_core/protocol/lufa/lufa.c

index dbee630d18175127e4d3aa333245ef2875d74dc9..f81877dd9f489a34e5c6bb896b75d5c47681ebb6 100644 (file)
@@ -76,7 +76,7 @@ void send_keyboard_report(void) {
 void add_key(uint8_t key)
 {
 #ifdef NKRO_ENABLE
-    if (keyboard_nkro) {
+    if (keyboard_protocol && keyboard_nkro) {
         add_key_bit(key);
         return;
     }
@@ -87,7 +87,7 @@ void add_key(uint8_t key)
 void del_key(uint8_t key)
 {
 #ifdef NKRO_ENABLE
-    if (keyboard_nkro) {
+    if (keyboard_protocol && keyboard_nkro) {
         del_key_bit(key);
         return;
     }
@@ -160,7 +160,7 @@ uint8_t has_anymod(void)
 uint8_t get_first_key(void)
 {
 #ifdef NKRO_ENABLE
-    if (keyboard_nkro) {
+    if (keyboard_protocol && keyboard_nkro) {
         uint8_t i = 0;
         for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
             ;
index a53cac61486253b48d8fe188fa6a476a076726e7..420e7eb9b4f1ca812811137bf95edad3d74a66f6 100644 (file)
@@ -315,6 +315,7 @@ static bool command_common(uint8_t code)
             print_val_hex8(host_keyboard_leds());
             print_val_hex8(keyboard_protocol);
             print_val_hex8(keyboard_idle);
+            print_val_hex8(keyboard_nkro);
             print_val_hex32(timer_count);
 
 #ifdef PROTOCOL_PJRC
index 188fb7b89b6469290ca9cd6f885a070ff7bb575d..345630aa90d54dd259f3d995c60d36274e033661 100644 (file)
@@ -53,6 +53,7 @@
 #include "lufa.h"
 
 uint8_t keyboard_idle = 0;
+/* 0: Boot Protocol, 1: Report Protocol(default) */
 uint8_t keyboard_protocol = 1;
 static uint8_t keyboard_led_stats = 0;
 
@@ -349,10 +350,7 @@ void EVENT_USB_Device_ControlRequest(void)
                     Endpoint_ClearSETUP();
                     Endpoint_ClearStatusStage();
 
-                    keyboard_protocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00);
-#ifdef NKRO_ENABLE
-                    keyboard_nkro = !!keyboard_protocol;
-#endif
+                    keyboard_protocol = (USB_ControlRequest.wValue & 0xFF);
                     clear_keyboard();
                 }
             }
@@ -399,7 +397,7 @@ static void send_keyboard(report_keyboard_t *report)
 
     /* Select the Keyboard Report Endpoint */
 #ifdef NKRO_ENABLE
-    if (keyboard_nkro) {
+    if (keyboard_protocol && keyboard_nkro) {
         /* Report protocol - NKRO */
         Endpoint_SelectEndpoint(NKRO_IN_EPNUM);