diff --git a/core/embed/projects/bootloader/bootui.h b/core/embed/projects/bootloader/bootui.h index ef438cc37e..d5728a9f15 100644 --- a/core/embed/projects/bootloader/bootui.h +++ b/core/embed/projects/bootloader/bootui.h @@ -34,6 +34,7 @@ typedef enum { MENU_EXIT = 0xAABBCCDD, MENU_REBOOT = 0x11223344, MENU_WIPE = 0x55667788, + MENU_TURN_OFF = 0x99AABBCC, } menu_result_t; // todo: use bindgen to tie this to rust diff --git a/core/embed/projects/bootloader/workflow/wf_bootloader.c b/core/embed/projects/bootloader/workflow/wf_bootloader.c index f2191b73fa..a44dd5b193 100644 --- a/core/embed/projects/bootloader/workflow/wf_bootloader.c +++ b/core/embed/projects/bootloader/workflow/wf_bootloader.c @@ -23,6 +23,10 @@ #include #include +#ifdef USE_POWERCTL +#include +#endif + #include "antiglitch.h" #include "bootui.h" #include "workflow.h" @@ -79,6 +83,11 @@ workflow_result_t workflow_bootloader(const vendor_header *const vhdr, } return WF_ERROR_FATAL; } + #ifdef USE_POWERCTL + if (menu_result == MENU_TURN_OFF) { + powerctl_hibernate(); + } +#endif break; case SCREEN_WAIT_FOR_HOST: workflow_result_t res = diff --git a/core/embed/rust/src/ui/layout_bolt/bootloader/menu.rs b/core/embed/rust/src/ui/layout_bolt/bootloader/menu.rs index 25e152b54d..3ff38887c0 100644 --- a/core/embed/rust/src/ui/layout_bolt/bootloader/menu.rs +++ b/core/embed/rust/src/ui/layout_bolt/bootloader/menu.rs @@ -1,7 +1,7 @@ use crate::{ trezorhal::secbool::{secbool, sectrue}, ui::{ - component::{Child, Component, Event, EventCtx, Label, Pad}, + component::{Component, Event, EventCtx, Label, Pad}, constant::{screen, WIDTH}, display::Icon, geometry::{Insets, Point, Rect}, @@ -26,14 +26,16 @@ pub enum MenuMsg { Close = 0xAABBCCDD, Reboot = 0x11223344, FactoryReset = 0x55667788, + TurnOff = 0x99AABBCC, } pub struct Menu { bg: Pad, - title: Child>, - close: Child