summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2023-06-26 23:55:52 +0200
committerGitHub <noreply@github.com>2023-06-26 23:55:52 +0200
commita87c74ebe14aee0d4a82f5ff8a0170afb8105598 (patch)
tree8c4505a97b2ed7d2d004a90d80d54e5d57ecdcf2 /tmk_core
parent4aa765b72e880246907bc16bc591e44b0235da97 (diff)
[Bug] Fix non-functional S3 wakeup / resume from suspense (#19780)
* Update ChibiOS-Contrib for USB suspend fixes * Remove S3 wakup workaround ChibiOS OTGv1 driver has a remote wakeup bug that prevents the device to resume it's operation. 02516cbc24647f522eee975e69cc0c8a925470eb introduced a hotfix that forcefully restarted the usb driver as a workaround. This workaround broke multiple boards which do not use this driver / peripheral. With the update of ChibiOS this hotfix is now obsolete. * Remove restart_usb_driver overrides they are no longer necessary as the workaround is not needed anymore for stm32f4 * Remove unused RP_USB_USE_SOF_INTR defines The SOF interrupt is enabled dynamically by the RP2040 usb driver
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/chibios/chibios.c22
-rw-r--r--tmk_core/protocol/lufa/lufa.c2
2 files changed, 10 insertions, 14 deletions
diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c
index 52aea241ff..1eebdaf6c3 100644
--- a/tmk_core/protocol/chibios/chibios.c
+++ b/tmk_core/protocol/chibios/chibios.c
@@ -180,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 */
+ 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/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()) {