summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZixun LI <[email protected]>2025-11-27 11:49:30 +0100
committerZixun LI <[email protected]>2025-11-27 11:49:30 +0100
commitb997ec725812d2f6a573610ba0dd817f271eddea (patch)
treee31f5b4369367f9a5d165d82913f3bbec8db94bf
parenta25e9e86c83785e8ce91b1c7b485a106195d368a (diff)
usbd: clear state and call callback on deinit
Signed-off-by: Zixun LI <[email protected]>
-rw-r--r--src/device/usbd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index d4dfae4b4..f923dfe08 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -587,6 +587,10 @@ bool tud_deinit(uint8_t rhport) {
}
}
+ // Clear device data
+ tu_varclr(&_usbd_dev);
+ usbd_control_reset();
+
// Deinit device queue & task
osal_queue_delete(_usbd_q);
_usbd_q = NULL;
@@ -598,6 +602,9 @@ bool tud_deinit(uint8_t rhport) {
#endif
_usbd_rhport = RHPORT_INVALID;
+
+ tud_umount_cb();
+
return true;
}