mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-23 23:08:14 +00:00
core: halt if the script ever runs out of the loop in main.py
This commit is contained in:
parent
3349f737df
commit
7de5cec4b0
@ -71,13 +71,13 @@ def _boot_apps() -> None:
|
|||||||
|
|
||||||
from trezor import loop, wire, workflow
|
from trezor import loop, wire, workflow
|
||||||
|
|
||||||
while True:
|
# initialize the wire codec
|
||||||
# initialize the wire codec
|
wire.setup(usb.iface_wire)
|
||||||
wire.setup(usb.iface_wire)
|
if __debug__:
|
||||||
if __debug__:
|
wire.setup(usb.iface_debug)
|
||||||
wire.setup(usb.iface_debug)
|
|
||||||
|
|
||||||
_boot_apps()
|
_boot_apps()
|
||||||
loop.run()
|
loop.run()
|
||||||
|
|
||||||
# loop is empty, reboot
|
# loop is empty. That should not happen
|
||||||
|
utils.halt("All tasks have died.")
|
||||||
|
@ -104,11 +104,14 @@ def _finalize_default(task: loop.Task, value: Any) -> None:
|
|||||||
log.debug(__name__, "default closed: %s", task)
|
log.debug(__name__, "default closed: %s", task)
|
||||||
default_task = None
|
default_task = None
|
||||||
|
|
||||||
if not tasks and default_constructor:
|
if not tasks:
|
||||||
# No registered workflows are running and we are in the default task
|
# No registered workflows are running and we are in the default task
|
||||||
# finalizer, so when this function finished, nothing will be running.
|
# finalizer, so when this function finished, nothing will be running.
|
||||||
# We must schedule a new instance of the default now.
|
# We must schedule a new instance of the default now.
|
||||||
start_default(default_constructor)
|
if default_constructor is not None:
|
||||||
|
start_default(default_constructor)
|
||||||
|
else:
|
||||||
|
raise RuntimeError # no tasks and no default constructor
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if __debug__:
|
if __debug__:
|
||||||
|
Loading…
Reference in New Issue
Block a user