mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
feat(core): show confirmation dialog before rebooting
This commit is contained in:
parent
60db3e3e52
commit
e66ed079b0
@ -1,7 +1,8 @@
|
|||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from trezor import utils, wire
|
from trezor import io, loop, utils, wire
|
||||||
from trezor.messages import RebootToBootloader, Success
|
from trezor.messages import RebootToBootloader, Success
|
||||||
|
from trezor.ui.layouts import confirm_action
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import NoReturn
|
from typing import NoReturn
|
||||||
@ -10,8 +11,16 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
|
|
||||||
async def reboot_to_bootloader(ctx: wire.Context, msg: RebootToBootloader) -> NoReturn:
|
async def reboot_to_bootloader(ctx: wire.Context, msg: RebootToBootloader) -> NoReturn:
|
||||||
await ctx.write(Success())
|
await confirm_action(
|
||||||
# writing synchronously twice makes USB flush properly before reboot
|
ctx,
|
||||||
await ctx.write(Success())
|
"reboot",
|
||||||
|
"Go to bootloader",
|
||||||
|
"Do you want to restart Trezor in bootloader mode?",
|
||||||
|
hold_danger=True,
|
||||||
|
verb="Restart",
|
||||||
|
)
|
||||||
|
await ctx.write(Success(message="Rebooting"))
|
||||||
|
# make sure the outgoing USB buffer is flushed
|
||||||
|
await loop.wait(ctx.iface.iface_num() | io.POLL_WRITE)
|
||||||
utils.reboot_to_bootloader()
|
utils.reboot_to_bootloader()
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
Loading…
Reference in New Issue
Block a user