Skip to content

Commit

Permalink
Add hotfix for chibios keyboards not wake (qmk#10088)
Browse files Browse the repository at this point in the history
  • Loading branch information
LSChyi authored and noroadsleft committed Oct 30, 2020
1 parent c44593c commit c876f15
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions tmk_core/protocol/chibios/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ int main(void) {
/* Remote wakeup */
if (suspend_wakeup_condition()) {
usbWakeupHost(&USB_DRIVER);
restart_usb_driver(&USB_DRIVER);
}
}
/* Woken up */
Expand Down
7 changes: 7 additions & 0 deletions tmk_core/protocol/chibios/usb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,13 @@ void init_usb_driver(USBDriver *usbp) {
chVTObjectInit(&keyboard_idle_timer);
}

void restart_usb_driver(USBDriver *usbp) {
usbStop(usbp);
usbDisconnectBus(usbp);
usbStart(usbp, &usbcfg);
usbConnectBus(usbp);
}

/* ---------------------------------------------------------
* Keyboard functions
* ---------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions tmk_core/protocol/chibios/usb_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
/* Initialize the USB driver and bus */
void init_usb_driver(USBDriver *usbp);

/* Restart the USB driver and bus */
void restart_usb_driver(USBDriver *usbp);

/* ---------------
* Keyboard header
* ---------------
Expand Down

0 comments on commit c876f15

Please sign in to comment.