diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index a0d28f9afc0..0e577d55195 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -230,6 +230,7 @@ int main(void) { /* Remote wakeup */ if (suspend_wakeup_condition()) { usbWakeupHost(&USB_DRIVER); + restart_usb_driver(&USB_DRIVER); } } /* Woken up */ diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index ae33e86a70d..59f6feb9519 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -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 * --------------------------------------------------------- diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h index 94baf9b35e0..d8813f48013 100644 --- a/tmk_core/protocol/chibios/usb_main.h +++ b/tmk_core/protocol/chibios/usb_main.h @@ -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 * ---------------