1
0
Fork 0

Fix Caps Lock LEDs once and for all (#4824)

* Check the size of the SET_REPORT packet

If we have two bytes, that probably means the first is a report ID. The 6KRO interface may or may not have one, but the NKRO interface always does, so we need to check this regardless of whether KEYBOARD_SHARED_EP is defined.

* Fix indentation
This commit is contained in:
fauxpark 2019-01-12 12:22:06 +11:00 committed by Drashna Jaelre
parent d9c5e5870e
commit 2c4109394f

View file

@ -517,17 +517,20 @@ void EVENT_USB_Device_ControlRequest(void)
if (USB_DeviceState == DEVICE_STATE_Unattached) if (USB_DeviceState == DEVICE_STATE_Unattached)
return; return;
} }
#ifdef KEYBOARD_SHARED_EP
uint8_t report_id = REPORT_ID_KEYBOARD; if (Endpoint_BytesInEndpoint() == 2) {
if (keyboard_protocol) { uint8_t report_id = REPORT_ID_KEYBOARD;
report_id = Endpoint_Read_8();
} if (keyboard_protocol) {
if (report_id == REPORT_ID_KEYBOARD || report_id == REPORT_ID_NKRO) { report_id = Endpoint_Read_8();
}
if (report_id == REPORT_ID_KEYBOARD || report_id == REPORT_ID_NKRO) {
keyboard_led_stats = Endpoint_Read_8(); keyboard_led_stats = Endpoint_Read_8();
}
} else {
keyboard_led_stats = Endpoint_Read_8();
} }
#else
keyboard_led_stats = Endpoint_Read_8();
#endif
Endpoint_ClearOUT(); Endpoint_ClearOUT();
Endpoint_ClearStatusStage(); Endpoint_ClearStatusStage();