]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Always read two bytes from the endpoint if we have two bytes to read
authorfauxpark <fauxpark@gmail.com>
Tue, 22 Jan 2019 10:43:17 +0000 (21:43 +1100)
committerDrashna Jaelre <drashna@live.com>
Tue, 22 Jan 2019 17:30:01 +0000 (09:30 -0800)
When this if statement is false, it will cause the report ID to be read as the LED state.
We already know there are two bytes in the endpoint, which is a reasonably good indicator that it contains a report ID, so we should always read both.

tmk_core/protocol/lufa/lufa.c

index cdabaf16e61d74407a3a18b1b417d98ae8c48e42..f2ecf246515686e69df6abadc93cb53d57c2fe94 100644 (file)
@@ -519,11 +519,7 @@ void EVENT_USB_Device_ControlRequest(void)
                     }
 
                     if (Endpoint_BytesInEndpoint() == 2) {
-                      uint8_t report_id = REPORT_ID_KEYBOARD;
-
-                      if (keyboard_protocol) {
-                        report_id = Endpoint_Read_8();
-                      }
+                      uint8_t report_id = Endpoint_Read_8();
 
                       if (report_id == REPORT_ID_KEYBOARD || report_id == REPORT_ID_NKRO) {
                         keyboard_led_stats = Endpoint_Read_8();