From 9e31e0f4d4175bceaf7decc2a7c537c8414095d0 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 24 Oct 2017 18:48:01 +0200 Subject: [PATCH] bootloader: stop/deinit usb for unplug events as well --- embed/bootloader/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/embed/bootloader/main.c b/embed/bootloader/main.c index ab15b787c1..bbd9881fed 100644 --- a/embed/bootloader/main.c +++ b/embed/bootloader/main.c @@ -202,9 +202,13 @@ bool bootloader_loop(void) r = process_msg_WipeDevice(USB_IFACE_NUM, msg_size, buf); if (r < 0) { // error display_error(); + usb_stop(); + usb_deinit(); return false; // shutdown } else { // success display_done(0); + usb_stop(); + usb_deinit(); return false; // shutdown } break; @@ -220,6 +224,8 @@ bool bootloader_loop(void) r = process_msg_FirmwareUpload(USB_IFACE_NUM, msg_size, buf); if (r < 0) { // error display_error(); + usb_stop(); + usb_deinit(); return false; // shutdown } else if (r == 0) { // last chunk received