usbd: clear state and call callback on deinit

Signed-off-by: Zixun LI <admin@hifiphile.com>
This commit is contained in:
Zixun LI
2025-11-27 11:49:30 +01:00
parent a25e9e86c8
commit b997ec7258

View File

@ -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;
}