Skip to content

Commit

Permalink
NKRO is disable when SET_PROTOCOL(boot)
Browse files Browse the repository at this point in the history
- Command can force to enable NKRO even when boot mode
- After boot keyboard may be in boot mode due to BIOS' request
  • Loading branch information
yashikno committed Apr 26, 2014
1 parent 5e3f2d2 commit 22854eb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions common/action_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void send_keyboard_report(void) {
void add_key(uint8_t key)
{
#ifdef NKRO_ENABLE
if (keyboard_nkro && keyboard_protocol) {
if (keyboard_nkro) {
add_key_bit(key);
return;
}
Expand All @@ -78,7 +78,7 @@ void add_key(uint8_t key)
void del_key(uint8_t key)
{
#ifdef NKRO_ENABLE
if (keyboard_nkro && keyboard_protocol) {
if (keyboard_nkro) {
del_key_bit(key);
return;
}
Expand Down Expand Up @@ -151,7 +151,7 @@ uint8_t has_anymod(void)
uint8_t get_first_key(void)
{
#ifdef NKRO_ENABLE
if (keyboard_nkro && keyboard_protocol) {
if (keyboard_nkro) {
uint8_t i = 0;
for (; i < REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
;
Expand Down
5 changes: 4 additions & 1 deletion protocol/lufa/lufa.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ void EVENT_USB_Device_ControlRequest(void)
Endpoint_ClearStatusStage();

keyboard_protocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00);
#ifdef NKRO_ENABLE
keyboard_nkro = !!keyboard_protocol;
#endif
clear_keyboard();
}
}
Expand Down Expand Up @@ -354,7 +357,7 @@ static void send_keyboard(report_keyboard_t *report)

/* Select the Keyboard Report Endpoint */
#ifdef NKRO_ENABLE
if (keyboard_nkro && keyboard_protocol) {
if (keyboard_nkro) {
/* Report protocol - NKRO */
Endpoint_SelectEndpoint(NKRO_IN_EPNUM);

Expand Down
3 changes: 3 additions & 0 deletions protocol/pjrc/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,9 @@ ISR(USB_COM_vect)
}
if (bRequest == HID_SET_PROTOCOL) {
keyboard_protocol = wValue;
#ifdef NKRO_ENABLE
keyboard_nkro = !!keyboard_protocol;
#endif
clear_keyboard();
//usb_wait_in_ready();
usb_send_in();
Expand Down
2 changes: 1 addition & 1 deletion protocol/pjrc/usb_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ int8_t usb_keyboard_send_report(report_keyboard_t *report)
int8_t result = 0;

#ifdef NKRO_ENABLE
if (keyboard_nkro && keyboard_protocol)
if (keyboard_nkro)
result = send_report(report, KBD2_ENDPOINT, 0, KBD2_SIZE);
else
#endif
Expand Down

0 comments on commit 22854eb

Please sign in to comment.