1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-07 16:49:04 +00:00
trezor-firmware/core/src/session.py
Roman Zeyde ad73e41080 feat(core): support USB/BLE sessions
All interfaces are sharing a single 8kB buffer.
It is reallocated once per session and is acquired by the first active session.
Other concurrent sessions will respond with an "Another session in progress" error.

[no changelog]
2025-03-31 13:20:53 +03:00

37 lines
690 B
Python

# isort: skip_file
from trezor import log, loop, utils, wire, workflow
import apps.base
import usb
apps.base.boot()
if not utils.BITCOIN_ONLY and usb.ENABLE_IFACE_WEBAUTHN:
import apps.webauthn
apps.webauthn.boot()
if __debug__:
import apps.debug
apps.debug.boot()
# run main event loop and specify which screen is the default
apps.base.set_homescreen()
workflow.start_default()
# initialize the wire codec over USB
wire.setup(usb.iface_wire)
if utils.USE_BLE:
from trezorio import ble
# initialize the wire codec over BLE
wire.setup(ble.BleInterface())
# start the event loop
loop.run()
if __debug__:
log.debug(__name__, "Restarting main loop")