summaryrefslogtreecommitdiffstats
path: root/tmk_core/protocol/chibios
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-10-02 15:35:33 +0200
committerGitHub <noreply@github.com>2022-10-02 15:35:33 +0200
commit6f13a76530165bb1ad723ab0270c9eb908ca3a8c (patch)
treed42e3adf2b79902e6db15ee560a5c78d86a18a83 /tmk_core/protocol/chibios
parentc4ff8192c2a43592e577e54b0019741c16fb1644 (diff)
[Core] ChibiOS: Fix USB bus disconnect handling (#18566)
Diffstat (limited to 'tmk_core/protocol/chibios')
-rw-r--r--tmk_core/protocol/chibios/usb_main.c3
-rw-r--r--tmk_core/protocol/chibios/usb_util.c1
2 files changed, 3 insertions, 1 deletions
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index 7c44b87bc4..3e64ceab19 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -734,6 +734,7 @@ void init_usb_driver(USBDriver *usbp) {
* after a reset.
*/
usbDisconnectBus(usbp);
+ usbStop(usbp);
wait_ms(50);
usbStart(usbp, &usbcfg);
usbConnectBus(usbp);
@@ -742,8 +743,8 @@ void init_usb_driver(USBDriver *usbp) {
}
__attribute__((weak)) void restart_usb_driver(USBDriver *usbp) {
- usbStop(usbp);
usbDisconnectBus(usbp);
+ usbStop(usbp);
#if USB_SUSPEND_WAKEUP_DELAY > 0
// Some hubs, kvm switches, and monitors do
diff --git a/tmk_core/protocol/chibios/usb_util.c b/tmk_core/protocol/chibios/usb_util.c
index c8b435db0c..a8c7d9a228 100644
--- a/tmk_core/protocol/chibios/usb_util.c
+++ b/tmk_core/protocol/chibios/usb_util.c
@@ -17,6 +17,7 @@
#include "usb_util.h"
void usb_disconnect(void) {
+ usbDisconnectBus(&USBD1);
usbStop(&USBD1);
}