Trigger a wakeup after USB Reset on ChibiOS. (#12831)
After a USB Reset event the device must, according to the spec wake up from any suspend state, so the Configured event that arrives afterwards should be interpreted as an implicit wakeup.master
parent
1409b36851
commit
982b782ce3
|
@ -415,14 +415,18 @@ static inline void usb_event_wakeup_handler(void) {
|
||||||
#endif /* SLEEP_LED_ENABLE */
|
#endif /* SLEEP_LED_ENABLE */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool last_suspend_state = false;
|
||||||
|
|
||||||
void usb_event_queue_task(void) {
|
void usb_event_queue_task(void) {
|
||||||
usbevent_t event;
|
usbevent_t event;
|
||||||
while (usb_event_queue_dequeue(&event)) {
|
while (usb_event_queue_dequeue(&event)) {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case USB_EVENT_SUSPEND:
|
case USB_EVENT_SUSPEND:
|
||||||
|
last_suspend_state = true;
|
||||||
usb_event_suspend_handler();
|
usb_event_suspend_handler();
|
||||||
break;
|
break;
|
||||||
case USB_EVENT_WAKEUP:
|
case USB_EVENT_WAKEUP:
|
||||||
|
last_suspend_state = false;
|
||||||
usb_event_wakeup_handler();
|
usb_event_wakeup_handler();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -464,6 +468,9 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) {
|
||||||
qmkusbConfigureHookI(&drivers.array[i].driver);
|
qmkusbConfigureHookI(&drivers.array[i].driver);
|
||||||
}
|
}
|
||||||
osalSysUnlockFromISR();
|
osalSysUnlockFromISR();
|
||||||
|
if (last_suspend_state) {
|
||||||
|
usb_event_queue_enqueue(USB_EVENT_WAKEUP);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
case USB_EVENT_SUSPEND:
|
case USB_EVENT_SUSPEND:
|
||||||
usb_event_queue_enqueue(USB_EVENT_SUSPEND);
|
usb_event_queue_enqueue(USB_EVENT_SUSPEND);
|
||||||
|
|
Loading…
Reference in New Issue