Add hotfix for chibios keyboards not wake (#10088)

This commit is contained in:
LSChyi 2020-10-04 03:19:04 +08:00 committed by James Young
parent eecedf0db5
commit b1a6b161f3
No known key found for this signature in database
GPG key ID: 8E1085BF6FCFBD74
3 changed files with 11 additions and 0 deletions

View file

@ -236,6 +236,7 @@ int main(void) {
/* Remote wakeup */ /* Remote wakeup */
if (suspend_wakeup_condition()) { if (suspend_wakeup_condition()) {
usbWakeupHost(&USB_DRIVER); usbWakeupHost(&USB_DRIVER);
restart_usb_driver(&USB_DRIVER);
} }
} }
/* Woken up */ /* Woken up */

View file

@ -574,6 +574,13 @@ void init_usb_driver(USBDriver *usbp) {
chVTObjectInit(&keyboard_idle_timer); chVTObjectInit(&keyboard_idle_timer);
} }
void restart_usb_driver(USBDriver *usbp) {
usbStop(usbp);
usbDisconnectBus(usbp);
usbStart(usbp, &usbcfg);
usbConnectBus(usbp);
}
/* --------------------------------------------------------- /* ---------------------------------------------------------
* Keyboard functions * Keyboard functions
* --------------------------------------------------------- * ---------------------------------------------------------

View file

@ -35,6 +35,9 @@
/* Initialize the USB driver and bus */ /* Initialize the USB driver and bus */
void init_usb_driver(USBDriver *usbp); void init_usb_driver(USBDriver *usbp);
/* Restart the USB driver and bus */
void restart_usb_driver(USBDriver *usbp);
/* --------------- /* ---------------
* Keyboard header * Keyboard header
* --------------- * ---------------