Skip to content

Commit

Permalink
[Core] ChibiOS: Fix USB bus disconnect handling (qmk#18566)
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlK90 authored and ramonimbao committed Nov 28, 2022
1 parent 405f662 commit efd8b6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tmk_core/protocol/chibios/usb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions tmk_core/protocol/chibios/usb_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "usb_util.h"

void usb_disconnect(void) {
usbDisconnectBus(&USBD1);
usbStop(&USBD1);
}

Expand Down

0 comments on commit efd8b6b

Please sign in to comment.