1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-03 20:11:00 +00:00

bootloader: stop/deinit usb for unplug events as well

This commit is contained in:
Pavol Rusnak 2017-10-24 18:48:01 +02:00
parent b922579173
commit 9e31e0f4d4
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -202,9 +202,13 @@ bool bootloader_loop(void)
r = process_msg_WipeDevice(USB_IFACE_NUM, msg_size, buf); r = process_msg_WipeDevice(USB_IFACE_NUM, msg_size, buf);
if (r < 0) { // error if (r < 0) { // error
display_error(); display_error();
usb_stop();
usb_deinit();
return false; // shutdown return false; // shutdown
} else { // success } else { // success
display_done(0); display_done(0);
usb_stop();
usb_deinit();
return false; // shutdown return false; // shutdown
} }
break; break;
@ -220,6 +224,8 @@ bool bootloader_loop(void)
r = process_msg_FirmwareUpload(USB_IFACE_NUM, msg_size, buf); r = process_msg_FirmwareUpload(USB_IFACE_NUM, msg_size, buf);
if (r < 0) { // error if (r < 0) { // error
display_error(); display_error();
usb_stop();
usb_deinit();
return false; // shutdown return false; // shutdown
} else } else
if (r == 0) { // last chunk received if (r == 0) { // last chunk received