diff options
Diffstat (limited to 'tmk_core')
-rw-r--r-- | tmk_core/protocol.mk | 2 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/arm_atsam.mk (renamed from tmk_core/protocol/arm_atsam.mk) | 0 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/chibios.c | 26 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/chibios.mk (renamed from tmk_core/protocol/chibios.mk) | 0 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 2 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/lufa.mk (renamed from tmk_core/protocol/lufa.mk) | 0 | ||||
-rw-r--r-- | tmk_core/protocol/usb_hid/usb_hid.mk (renamed from tmk_core/protocol/usb_hid.mk) | 0 | ||||
-rw-r--r-- | tmk_core/protocol/vusb/vusb.mk (renamed from tmk_core/protocol/vusb.mk) | 0 |
8 files changed, 14 insertions, 16 deletions
diff --git a/tmk_core/protocol.mk b/tmk_core/protocol.mk index d3f15c4588..2ae7aa9abe 100644 --- a/tmk_core/protocol.mk +++ b/tmk_core/protocol.mk @@ -99,7 +99,7 @@ ifeq ($(strip $(SHARED_EP_ENABLE)), yes) endif ifeq ($(strip $(USB_HID_ENABLE)), yes) - include $(TMK_DIR)/protocol/usb_hid.mk + include $(TMK_DIR)/protocol/usb_hid/usb_hid.mk endif # Search Path diff --git a/tmk_core/protocol/arm_atsam.mk b/tmk_core/protocol/arm_atsam/arm_atsam.mk index ffd1fa9f50..ffd1fa9f50 100644 --- a/tmk_core/protocol/arm_atsam.mk +++ b/tmk_core/protocol/arm_atsam/arm_atsam.mk diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c index 10a976608a..1eebdaf6c3 100644 --- a/tmk_core/protocol/chibios/chibios.c +++ b/tmk_core/protocol/chibios/chibios.c @@ -49,6 +49,8 @@ #include "suspend.h" #include "wait.h" +#define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED (2U) + /* ------------------------- * TMK host driver defs * ------------------------- @@ -178,28 +180,24 @@ void protocol_post_init(void) { } void protocol_pre_task(void) { - usb_event_queue_task(); - #if !defined(NO_USB_STARTUP_CHECK) if (USB_DRIVER.state == USB_SUSPENDED) { - print("[s]"); + dprintln("suspending keyboard"); while (USB_DRIVER.state == USB_SUSPENDED) { - /* Do this in the suspended state */ - suspend_power_down(); // on AVR this deep sleeps for 15ms - /* Remote wakeup */ - if (suspend_wakeup_condition()) { + suspend_power_down(); + if ((USB_DRIVER.status & USB_GETSTATUS_REMOTE_WAKEUP_ENABLED) && suspend_wakeup_condition()) { + /* issue a remote wakeup event to the host which should resume + * the bus and get our keyboard out of suspension. */ usbWakeupHost(&USB_DRIVER); - restart_usb_driver(&USB_DRIVER); } } - /* Woken up */ - // variables has been already cleared by the wakeup hook - send_keyboard_report(); -# ifdef MOUSEKEY_ENABLE - mousekey_send(); -# endif /* MOUSEKEY_ENABLE */ + /* after a successful wakeup a USB_EVENT_WAKEUP is signaled to QMK by + * ChibiOS, which triggers a wakeup callback that restores the state of + * the keyboard. Therefore we do nothing here. */ } #endif + + usb_event_queue_task(); } void protocol_post_task(void) { diff --git a/tmk_core/protocol/chibios.mk b/tmk_core/protocol/chibios/chibios.mk index 8eaf5b10d2..8eaf5b10d2 100644 --- a/tmk_core/protocol/chibios.mk +++ b/tmk_core/protocol/chibios/chibios.mk diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 20bfc8fb3c..d1cda24227 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -858,7 +858,7 @@ void protocol_post_init(void) { void protocol_pre_task(void) { #if !defined(NO_USB_STARTUP_CHECK) if (USB_DeviceState == DEVICE_STATE_Suspended) { - print("[s]"); + dprintln("suspending keyboard"); while (USB_DeviceState == DEVICE_STATE_Suspended) { suspend_power_down(); if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) { diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa/lufa.mk index b048c1836c..b048c1836c 100644 --- a/tmk_core/protocol/lufa.mk +++ b/tmk_core/protocol/lufa/lufa.mk diff --git a/tmk_core/protocol/usb_hid.mk b/tmk_core/protocol/usb_hid/usb_hid.mk index c0c157c043..c0c157c043 100644 --- a/tmk_core/protocol/usb_hid.mk +++ b/tmk_core/protocol/usb_hid/usb_hid.mk diff --git a/tmk_core/protocol/vusb.mk b/tmk_core/protocol/vusb/vusb.mk index 5572597e21..5572597e21 100644 --- a/tmk_core/protocol/vusb.mk +++ b/tmk_core/protocol/vusb/vusb.mk |