You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/core/src/apps/management/reboot_to_bootloader.py

31 lines
901 B

from typing import TYPE_CHECKING
import storage.device
from trezor import io, loop, utils, wire
from trezor.messages import RebootToBootloader, Success
from trezor.ui.layouts import confirm_action
if TYPE_CHECKING:
from typing import NoReturn
pass
async def reboot_to_bootloader(ctx: wire.Context, msg: RebootToBootloader) -> NoReturn:
if not storage.device.get_experimental_features():
raise wire.UnexpectedMessage("Experimental features are not enabled")
await confirm_action(
ctx,
"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()
raise RuntimeError