From 03aac60681222266a77aa7a4bbfd690c298b8cfb Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Thu, 13 Apr 2017 19:30:05 +0200 Subject: [PATCH] trezorhal: disable interfaces on deinit --- micropython/trezorhal/usb.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/micropython/trezorhal/usb.c b/micropython/trezorhal/usb.c index 146dc2bb30..eb58dfb3a0 100644 --- a/micropython/trezorhal/usb.c +++ b/micropython/trezorhal/usb.c @@ -100,15 +100,21 @@ int usb_init(const usb_dev_info_t *dev_info) { } int usb_deinit(void) { - return USBD_DeInit(&usb_dev_handle); + USBD_DeInit(&usb_dev_handle); + for (int i = 0; i < USBD_MAX_NUM_INTERFACES; i++) { + usb_ifaces[i].type = USB_IFACE_TYPE_DISABLED; + } + return 0; } int usb_start(void) { - return USBD_Start(&usb_dev_handle); + USBD_Start(&usb_dev_handle); + return 0; } int usb_stop(void) { - return USBD_Stop(&usb_dev_handle); + USBD_Stop(&usb_dev_handle); + return 0; } /*