feat(core): allow bootloader unlock on U5 in non-production builds

[no changelog]
tychovrahe/u5/bootloader_unlock
tychovrahe 4 weeks ago
parent 82e62cf41c
commit c27eb61ee4

@ -222,7 +222,7 @@ static usb_result_t bootloader_usb_loop(const vendor_header *const vhdr,
case MessageType_MessageType_GetFeatures:
process_msg_GetFeatures(USB_IFACE_NUM, msg_size, buf, vhdr, hdr);
break;
#if defined USE_OPTIGA && !defined STM32U5
#if defined USE_OPTIGA && ((!defined STM32U5) || !PRODUCTION)
case MessageType_MessageType_UnlockBootloader:
response = ui_screen_unlock_bootloader_confirm();
if (INPUT_CANCEL == response) {

@ -837,7 +837,7 @@ void process_msg_unknown(uint8_t iface_num, uint32_t msg_size, uint8_t *buf) {
MSG_SEND(Failure);
}
#if defined USE_OPTIGA && !defined STM32U5
#if defined USE_OPTIGA && ((!defined STM32U5) || !PRODUCTION)
void process_msg_UnlockBootloader(uint8_t iface_num, uint32_t msg_size,
uint8_t *buf) {
secret_erase();

@ -216,11 +216,33 @@ impl UIFeaturesBootloader for ModelMercuryFeatures {
}
fn screen_unlock_bootloader_confirm() -> u32 {
unimplemented!();
let icon = Icon::new(WARNING40);
let msg = Label::centered(
"Are you sure you want to unlock bootloader?".into(),
TEXT_WIPE_NORMAL,
);
let alert = Label::centered("This action cannot be undone!".into(), TEXT_WIPE_BOLD);
let right = Button::with_text("UNLOCK".into()).styled(button_wipe_confirm());
let left = Button::with_text("CANCEL".into()).styled(button_wipe_cancel());
let mut frame = Confirm::new(BLD_WIPE_COLOR, left, right, ConfirmTitle::Icon(icon), msg)
.with_alert(alert);
run(&mut frame)
}
fn screen_unlock_bootloader_success() {
unimplemented!();
let mut frame = ResultScreen::new(
&RESULT_WIPE,
Icon::new(CHECK40),
"Bootloader unlocked\nsuccessfully".into(),
Label::centered(RECONNECT_MESSAGE.into(), RESULT_WIPE.title_style())
.vertically_centered(),
true,
);
show(&mut frame, true);
}
fn screen_menu(firmware_present: secbool) -> u32 {

Loading…
Cancel
Save