forked from mirrors/qmk_firmware
Chibios USB: Take into account if host wants remote wakeup or not (#21287)
According to the USB 2.0 spec, remote wakeup should be disabled by default, and should only be enabled if the host explicitly requests it. The chibios driver code already takes care of storing this information, and returning it on GET_STATUS requests. However our application code has been ignoring it so far. This is a USB compliance issue, but also a bug that causes trouble in some cases: On RP2040 targets this has been causing problems if a key is held down while the keyboard is plugged in. The keyboard would fail to enumerate until all keys are released. With this change that behavior is fixed. Note that for LUFA targets this is already done correctly.
This commit is contained in:
parent
2f9f555add
commit
3ebdb1258b
1 changed files with 3 additions and 1 deletions
|
@ -49,6 +49,8 @@
|
|||
#include "suspend.h"
|
||||
#include "wait.h"
|
||||
|
||||
#define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED (2U)
|
||||
|
||||
/* -------------------------
|
||||
* TMK host driver defs
|
||||
* -------------------------
|
||||
|
@ -187,7 +189,7 @@ void protocol_pre_task(void) {
|
|||
/* Do this in the suspended state */
|
||||
suspend_power_down(); // on AVR this deep sleeps for 15ms
|
||||
/* Remote wakeup */
|
||||
if (suspend_wakeup_condition()) {
|
||||
if ((USB_DRIVER.status & USB_GETSTATUS_REMOTE_WAKEUP_ENABLED) && suspend_wakeup_condition()) {
|
||||
usbWakeupHost(&USB_DRIVER);
|
||||
restart_usb_driver(&USB_DRIVER);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue