diff options
author | Stefan Kerkmann <[email protected]> | 2024-02-28 12:00:27 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-02-28 22:00:27 +1100 |
commit | 0e02b0c41e47d5f5ad799a9860869b9d30ab881a (patch) | |
tree | 4b9cf95e22162db622ea049ea96bc0d15358cf9f /tmk_core/protocol/chibios/chibios.c | |
parent | b43f6cb7ef33f38ee494f639e2704a25c1e68332 (diff) | |
download | qmk_firmware-0e02b0c41e47d5f5ad799a9860869b9d30ab881a.tar.gz qmk_firmware-0e02b0c41e47d5f5ad799a9860869b9d30ab881a.zip |
[Core] Refactor ChibiOS USB endpoints to be fully async (#21656)
Diffstat (limited to 'tmk_core/protocol/chibios/chibios.c')
-rw-r--r-- | tmk_core/protocol/chibios/chibios.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c index 91bb252c7c..76a37ae538 100644 --- a/tmk_core/protocol/chibios/chibios.c +++ b/tmk_core/protocol/chibios/chibios.c @@ -192,15 +192,18 @@ void protocol_pre_task(void) { /* Remote wakeup */ if ((USB_DRIVER.status & USB_GETSTATUS_REMOTE_WAKEUP_ENABLED) && suspend_wakeup_condition()) { usbWakeupHost(&USB_DRIVER); - restart_usb_driver(&USB_DRIVER); +# if USB_SUSPEND_WAKEUP_DELAY > 0 + // Some hubs, kvm switches, and monitors do + // weird things, with USB device state bouncing + // around wildly on wakeup, yielding race + // conditions that can corrupt the keyboard state. + // + // Pause for a while to let things settle... + wait_ms(USB_SUSPEND_WAKEUP_DELAY); +# endif } } /* Woken up */ - // variables has been already cleared by the wakeup hook - send_keyboard_report(); -# ifdef MOUSEKEY_ENABLE - mousekey_send(); -# endif /* MOUSEKEY_ENABLE */ } #endif } @@ -218,4 +221,5 @@ void protocol_post_task(void) { #ifdef RAW_ENABLE raw_hid_task(); #endif + usb_idle_task(); } |