Skip to content

Commit

Permalink
Always read two bytes from the endpoint if we have two bytes to read
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fauxpark authored and drashna committed Jan 22, 2019
1 parent 8cf7265 commit ae79b60
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions tmk_core/protocol/lufa/lufa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit ae79b60

Please sign in to comment.