aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F30x/USB_CDC/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/STM32F30x/USB_CDC/main.c')
-rw-r--r--testhal/STM32/STM32F30x/USB_CDC/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/testhal/STM32/STM32F30x/USB_CDC/main.c b/testhal/STM32/STM32F30x/USB_CDC/main.c
index c40a82cb1..c99d56466 100644
--- a/testhal/STM32/STM32F30x/USB_CDC/main.c
+++ b/testhal/STM32/STM32F30x/USB_CDC/main.c
@@ -306,6 +306,12 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
chSysUnlockFromISR();
return;
case USB_EVENT_SUSPEND:
+ chSysLockFromISR();
+
+ /* Disconnection event on suspend.*/
+ sduDisconnectI(&SDU1);
+
+ chSysUnlockFromISR();
return;
case USB_EVENT_WAKEUP:
return;