From 8bd258db6f2d5ac0395629013eac9e5591febea9 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 24 Oct 2017 19:19:57 +0200 Subject: [PATCH] trezorhal: added calls to USBD_LL_FlushEP in deinit functions --- embed/trezorhal/usb_hid-impl.h | 3 +++ embed/trezorhal/usb_vcp-impl.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/embed/trezorhal/usb_hid-impl.h b/embed/trezorhal/usb_hid-impl.h index 520d99ff0..b9be77dfb 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 e0b51605b..8bcf8d971 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);