diff --git a/embed/trezorhal/usb_hid-impl.h b/embed/trezorhal/usb_hid-impl.h index 520d99ff..b9be77df 100644 --- a/embed/trezorhal/usb_hid-impl.h +++ b/embed/trezorhal/usb_hid-impl.h @@ -233,6 +233,9 @@ static void usb_hid_class_init(USBD_HandleTypeDef *dev, usb_hid_state_t *state, } static void usb_hid_class_deinit(USBD_HandleTypeDef *dev, usb_hid_state_t *state, uint8_t cfg_idx) { + // Flush endpoints + USBD_LL_FlushEP(dev, state->ep_in); + USBD_LL_FlushEP(dev, state->ep_out); // Close endpoints USBD_LL_CloseEP(dev, state->ep_in); USBD_LL_CloseEP(dev, state->ep_out); diff --git a/embed/trezorhal/usb_vcp-impl.h b/embed/trezorhal/usb_vcp-impl.h index e0b51605..8bcf8d97 100644 --- a/embed/trezorhal/usb_vcp-impl.h +++ b/embed/trezorhal/usb_vcp-impl.h @@ -331,6 +331,10 @@ static void usb_vcp_class_init(USBD_HandleTypeDef *dev, usb_vcp_state_t *state, } static void usb_vcp_class_deinit(USBD_HandleTypeDef *dev, usb_vcp_state_t *state, uint8_t cfg_idx) { + // Flush endpoints + USBD_LL_FlushEP(dev, state->ep_in); + USBD_LL_FlushEP(dev, state->ep_out); + USBD_LL_FlushEP(dev, state->ep_cmd); // Close endpoints USBD_LL_CloseEP(dev, state->ep_in); USBD_LL_CloseEP(dev, state->ep_out);