aboutsummaryrefslogtreecommitdiff
path: root/protocol/pjrc/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocol/pjrc/usb.c')
-rw-r--r--protocol/pjrc/usb.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/protocol/pjrc/usb.c b/protocol/pjrc/usb.c
index 393b36f78..b09ad3f23 100644
--- a/protocol/pjrc/usb.c
+++ b/protocol/pjrc/usb.c
@@ -38,6 +38,7 @@
38#include "sleep_led.h" 38#include "sleep_led.h"
39#endif 39#endif
40#include "suspend.h" 40#include "suspend.h"
41#include "action.h"
41#include "action_util.h" 42#include "action_util.h"
42 43
43 44
@@ -692,20 +693,20 @@ ISR(USB_GEN_vect)
692 } 693 }
693 /* TODO: should keep IDLE rate on each keyboard interface */ 694 /* TODO: should keep IDLE rate on each keyboard interface */
694#ifdef NKRO_ENABLE 695#ifdef NKRO_ENABLE
695 if (!keyboard_nkro && usb_keyboard_idle_config && (++div4 & 3) == 0) { 696 if (!keyboard_nkro && keyboard_idle && (++div4 & 3) == 0) {
696#else 697#else
697 if (usb_keyboard_idle_config && (++div4 & 3) == 0) { 698 if (keyboard_idle && (++div4 & 3) == 0) {
698#endif 699#endif
699 UENUM = KBD_ENDPOINT; 700 UENUM = KBD_ENDPOINT;
700 if (UEINTX & (1<<RWAL)) { 701 if (UEINTX & (1<<RWAL)) {
701 usb_keyboard_idle_count++; 702 usb_keyboard_idle_count++;
702 if (usb_keyboard_idle_count == usb_keyboard_idle_config) { 703 if (usb_keyboard_idle_count == keyboard_idle) {
703 usb_keyboard_idle_count = 0; 704 usb_keyboard_idle_count = 0;
704 /* TODO: fix keyboard_report inconsistency */ 705 /* TODO: fix keyboard_report inconsistency */
705/* To avoid Mac SET_IDLE behaviour. 706/* To avoid Mac SET_IDLE behaviour.
706 UEDATX = keyboard_report_prev->mods; 707 UEDATX = keyboard_report_prev->mods;
707 UEDATX = 0; 708 UEDATX = 0;
708 uint8_t keys = usb_keyboard_protocol ? KBD_REPORT_KEYS : 6; 709 uint8_t keys = keyboard_protocol ? KBD_REPORT_KEYS : 6;
709 for (uint8_t i=0; i<keys; i++) { 710 for (uint8_t i=0; i<keys; i++) {
710 UEDATX = keyboard_report_prev->keys[i]; 711 UEDATX = keyboard_report_prev->keys[i];
711 } 712 }
@@ -901,13 +902,13 @@ ISR(USB_COM_vect)
901 } 902 }
902 if (bRequest == HID_GET_IDLE) { 903 if (bRequest == HID_GET_IDLE) {
903 usb_wait_in_ready(); 904 usb_wait_in_ready();
904 UEDATX = usb_keyboard_idle_config; 905 UEDATX = keyboard_idle;
905 usb_send_in(); 906 usb_send_in();
906 return; 907 return;
907 } 908 }
908 if (bRequest == HID_GET_PROTOCOL) { 909 if (bRequest == HID_GET_PROTOCOL) {
909 usb_wait_in_ready(); 910 usb_wait_in_ready();
910 UEDATX = usb_keyboard_protocol; 911 UEDATX = keyboard_protocol;
911 usb_send_in(); 912 usb_send_in();
912 return; 913 return;
913 } 914 }
@@ -921,14 +922,15 @@ ISR(USB_COM_vect)
921 return; 922 return;
922 } 923 }
923 if (bRequest == HID_SET_IDLE) { 924 if (bRequest == HID_SET_IDLE) {
924 usb_keyboard_idle_config = (wValue >> 8); 925 keyboard_idle = (wValue >> 8);
925 usb_keyboard_idle_count = 0; 926 usb_keyboard_idle_count = 0;
926 //usb_wait_in_ready(); 927 //usb_wait_in_ready();
927 usb_send_in(); 928 usb_send_in();
928 return; 929 return;
929 } 930 }
930 if (bRequest == HID_SET_PROTOCOL) { 931 if (bRequest == HID_SET_PROTOCOL) {
931 usb_keyboard_protocol = wValue; 932 keyboard_protocol = wValue;
933 clear_keyboard();
932 //usb_wait_in_ready(); 934 //usb_wait_in_ready();
933 usb_send_in(); 935 usb_send_in();
934 return; 936 return;