mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 14:58:09 +00:00
refactor(core/embed): remove unnecessary call to usb_stop
[no changelog]
This commit is contained in:
parent
d8d6410284
commit
089dc84f38
@ -165,7 +165,6 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
|
|||||||
if (INPUT_CANCEL == response) {
|
if (INPUT_CANCEL == response) {
|
||||||
send_user_abort(USB_IFACE_NUM, "Wipe cancelled");
|
send_user_abort(USB_IFACE_NUM, "Wipe cancelled");
|
||||||
hal_delay(100);
|
hal_delay(100);
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return RETURN_TO_MENU;
|
return RETURN_TO_MENU;
|
||||||
}
|
}
|
||||||
@ -174,13 +173,11 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
|
|||||||
if (r < 0) { // error
|
if (r < 0) { // error
|
||||||
screen_wipe_fail();
|
screen_wipe_fail();
|
||||||
hal_delay(100);
|
hal_delay(100);
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return SHUTDOWN;
|
return SHUTDOWN;
|
||||||
} else { // success
|
} else { // success
|
||||||
screen_wipe_success();
|
screen_wipe_success();
|
||||||
hal_delay(100);
|
hal_delay(100);
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return SHUTDOWN;
|
return SHUTDOWN;
|
||||||
}
|
}
|
||||||
@ -197,12 +194,10 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
|
|||||||
} else {
|
} else {
|
||||||
ui_screen_fail();
|
ui_screen_fail();
|
||||||
}
|
}
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return SHUTDOWN;
|
return SHUTDOWN;
|
||||||
} else if (r == UPLOAD_ERR_USER_ABORT) {
|
} else if (r == UPLOAD_ERR_USER_ABORT) {
|
||||||
hal_delay(100);
|
hal_delay(100);
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return RETURN_TO_MENU;
|
return RETURN_TO_MENU;
|
||||||
} else if (r == 0) { // last chunk received
|
} else if (r == 0) { // last chunk received
|
||||||
@ -214,7 +209,6 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
|
|||||||
hal_delay(1000);
|
hal_delay(1000);
|
||||||
ui_screen_done(1, secfalse);
|
ui_screen_done(1, secfalse);
|
||||||
hal_delay(1000);
|
hal_delay(1000);
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return CONTINUE_TO_FIRMWARE;
|
return CONTINUE_TO_FIRMWARE;
|
||||||
}
|
}
|
||||||
@ -228,14 +222,12 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
|
|||||||
if (INPUT_CANCEL == response) {
|
if (INPUT_CANCEL == response) {
|
||||||
send_user_abort(USB_IFACE_NUM, "Bootloader unlock cancelled");
|
send_user_abort(USB_IFACE_NUM, "Bootloader unlock cancelled");
|
||||||
hal_delay(100);
|
hal_delay(100);
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return RETURN_TO_MENU;
|
return RETURN_TO_MENU;
|
||||||
}
|
}
|
||||||
process_msg_UnlockBootloader(USB_IFACE_NUM, msg_size, buf);
|
process_msg_UnlockBootloader(USB_IFACE_NUM, msg_size, buf);
|
||||||
screen_unlock_bootloader_success();
|
screen_unlock_bootloader_success();
|
||||||
hal_delay(100);
|
hal_delay(100);
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return SHUTDOWN;
|
return SHUTDOWN;
|
||||||
break;
|
break;
|
||||||
|
@ -117,12 +117,10 @@ static secbool bootloader_usb_loop(const vendor_header *const vhdr,
|
|||||||
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
|
||||||
ui_screen_fail();
|
ui_screen_fail();
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return secfalse; // shutdown
|
return secfalse; // shutdown
|
||||||
} else { // success
|
} else { // success
|
||||||
ui_screen_done(0, sectrue);
|
ui_screen_done(0, sectrue);
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return secfalse; // shutdown
|
return secfalse; // shutdown
|
||||||
}
|
}
|
||||||
@ -134,7 +132,6 @@ static secbool bootloader_usb_loop(const vendor_header *const vhdr,
|
|||||||
r = process_msg_FirmwareUpload(USB_IFACE_NUM, msg_size, buf);
|
r = process_msg_FirmwareUpload(USB_IFACE_NUM, msg_size, buf);
|
||||||
if (r < 0 && r != UPLOAD_ERR_USER_ABORT) { // error, but not user abort
|
if (r < 0 && r != UPLOAD_ERR_USER_ABORT) { // error, but not user abort
|
||||||
ui_screen_fail();
|
ui_screen_fail();
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return secfalse; // shutdown
|
return secfalse; // shutdown
|
||||||
} else if (r == 0) { // last chunk received
|
} else if (r == 0) { // last chunk received
|
||||||
@ -146,7 +143,6 @@ static secbool bootloader_usb_loop(const vendor_header *const vhdr,
|
|||||||
hal_delay(1000);
|
hal_delay(1000);
|
||||||
ui_screen_done(1, secfalse);
|
ui_screen_done(1, secfalse);
|
||||||
hal_delay(1000);
|
hal_delay(1000);
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
return sectrue; // jump to firmware
|
return sectrue; // jump to firmware
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,6 @@ STATIC mp_obj_t mod_trezorio_USB_close(mp_obj_t self) {
|
|||||||
if (o->state != USB_OPENED) {
|
if (o->state != USB_OPENED) {
|
||||||
mp_raise_msg(&mp_type_RuntimeError, "not initialized");
|
mp_raise_msg(&mp_type_RuntimeError, "not initialized");
|
||||||
}
|
}
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
mp_obj_list_set_len(MP_OBJ_FROM_PTR(&o->ifaces), 0);
|
mp_obj_list_set_len(MP_OBJ_FROM_PTR(&o->ifaces), 0);
|
||||||
mp_seq_clear(o->ifaces.items, 0, o->ifaces.alloc, sizeof(*o->ifaces.items));
|
mp_seq_clear(o->ifaces.items, 0, o->ifaces.alloc, sizeof(*o->ifaces.items));
|
||||||
@ -271,7 +270,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorio_USB_close_obj,
|
|||||||
STATIC mp_obj_t mod_trezorio_USB___del__(mp_obj_t self) {
|
STATIC mp_obj_t mod_trezorio_USB___del__(mp_obj_t self) {
|
||||||
mp_obj_USB_t *o = MP_OBJ_TO_PTR(self);
|
mp_obj_USB_t *o = MP_OBJ_TO_PTR(self);
|
||||||
if (o->state != USB_CLOSED) {
|
if (o->state != USB_CLOSED) {
|
||||||
usb_stop();
|
|
||||||
usb_deinit();
|
usb_deinit();
|
||||||
o->state = USB_CLOSED;
|
o->state = USB_CLOSED;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user