1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00
trezor-firmware/core/src/main.py

90 lines
1.8 KiB
Python
Raw Normal View History

# isort:skip_file
# unlock the device
import boot # noqa: F401
2017-10-24 11:59:09 +00:00
# prepare the USB interfaces, but do not connect to the host yet
import usb
2019-07-11 14:52:25 +00:00
from trezor import wire, utils
2017-08-15 13:09:09 +00:00
2017-08-21 11:22:44 +00:00
# initialize the wire codec and start the USB
wire.setup(usb.iface_wire)
2017-10-30 16:34:21 +00:00
if __debug__:
wire.setup(usb.iface_debug)
usb.bus.open()
# switch into unprivileged mode, as we don't need the extra permissions anymore
utils.set_mode_unprivileged()
2018-07-03 14:20:58 +00:00
2019-07-11 14:52:25 +00:00
def _boot_recovery():
# load applications
import apps.management
# boot applications
apps.management.boot()
if __debug__:
import apps.debug
apps.debug.boot()
from apps.management.recovery_device.homescreen import recovery_homescreen
loop.schedule(recovery_homescreen())
def _boot_default():
# load applications
import apps.homescreen
import apps.management
import apps.wallet
import apps.ethereum
import apps.lisk
import apps.monero
import apps.nem
import apps.stellar
import apps.ripple
import apps.cardano
import apps.tezos
import apps.eos
if __debug__:
import apps.debug
else:
import apps.webauthn
# boot applications
apps.homescreen.boot()
apps.management.boot()
apps.wallet.boot()
apps.ethereum.boot()
apps.lisk.boot()
apps.monero.boot()
apps.nem.boot()
apps.stellar.boot()
apps.ripple.boot()
apps.cardano.boot()
apps.tezos.boot()
apps.eos.boot()
if __debug__:
apps.debug.boot()
else:
apps.webauthn.boot(usb.iface_webauthn)
# run main event loop and specify which screen is the default
from apps.homescreen.homescreen import homescreen
workflow.startdefault(homescreen)
from trezor import loop, workflow
from apps.common.storage import recovery
if recovery.is_in_progress():
_boot_recovery()
else:
_boot_default()
2017-08-21 11:22:44 +00:00
loop.run()