diff options
Diffstat (limited to 'pjrc')
-rw-r--r-- | pjrc/host.c | 4 | ||||
-rw-r--r-- | pjrc/usb.c | 7 | ||||
-rw-r--r-- | pjrc/usb_keyboard.c | 1 |
3 files changed, 9 insertions, 3 deletions
diff --git a/pjrc/host.c b/pjrc/host.c index 8da88517b5..b69c6cb20c 100644 --- a/pjrc/host.c +++ b/pjrc/host.c @@ -1,4 +1,5 @@ #include <stdint.h> +#include <avr/interrupt.h> #include "usb_keycodes.h" #include "usb_keyboard.h" #include "usb_mouse.h" @@ -58,9 +59,12 @@ void host_add_code(uint8_t code) void host_swap_keyboard_report(void) { + uint8_t sreg = SREG; + cli(); report_keyboard_t *tmp = keyboard_report_prev; keyboard_report_prev = keyboard_report; keyboard_report = tmp; + SREG = sreg; } void host_clear_keyboard_report(void) diff --git a/pjrc/usb.c b/pjrc/usb.c index 9fd30dee3c..3cfe947310 100644 --- a/pjrc/usb.c +++ b/pjrc/usb.c @@ -687,10 +687,11 @@ ISR(USB_GEN_vect) usb_keyboard_idle_count++; if (usb_keyboard_idle_count == usb_keyboard_idle_config) { usb_keyboard_idle_count = 0; - UEDATX = keyboard_report->mods; + UEDATX = keyboard_report_prev->mods; UEDATX = 0; - for (i=0; i<6; i++) { - UEDATX = keyboard_report->keys[i]; + uint8_t keys = usb_keyboard_protocol ? KBD_REPORT_KEYS : 6; + for (i=0; i<keys; i++) { + UEDATX = keyboard_report_prev->keys[i]; } UEINTX = 0x3A; } diff --git a/pjrc/usb_keyboard.c b/pjrc/usb_keyboard.c index fc05f7c9e7..8aae2d3818 100644 --- a/pjrc/usb_keyboard.c +++ b/pjrc/usb_keyboard.c @@ -15,6 +15,7 @@ uint8_t usb_keyboard_protocol=1; // the idle configuration, how often we send the report to the // host (ms * 4) even when it hasn't changed +// Windows and Linux set 0 while OS X sets 6(24ms) by SET_IDLE request. uint8_t usb_keyboard_idle_config=125; // count until idle timeout |