mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-28 03:38:46 +00:00
refactor(core): ignore BLE exceptions on boot
[no changelog]
This commit is contained in:
parent
927ad3944b
commit
5b2e660f14
@ -590,7 +590,11 @@ env.Ignore(hdr_moduledefs, qstr_generated)
|
||||
if FROZEN:
|
||||
SOURCE_PY_DIR = 'src/'
|
||||
|
||||
SOURCE_PY = Glob(SOURCE_PY_DIR + '*.py')
|
||||
SOURCE_PY = Glob(SOURCE_PY_DIR + '*.py',
|
||||
exclude=[
|
||||
SOURCE_PY_DIR + 'ble.py',
|
||||
] if "ble" not in FEATURES_AVAILABLE else []
|
||||
)
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/*.py',
|
||||
exclude=[
|
||||
SOURCE_PY_DIR + 'trezor/sdcard.py',
|
||||
|
@ -645,7 +645,11 @@ env.Ignore(micropy_defines, qstr_generated)
|
||||
if FROZEN:
|
||||
SOURCE_PY_DIR = 'src/'
|
||||
|
||||
SOURCE_PY = Glob(SOURCE_PY_DIR + '*.py')
|
||||
SOURCE_PY = Glob(SOURCE_PY_DIR + '*.py',
|
||||
exclude=[
|
||||
SOURCE_PY_DIR + 'ble.py',
|
||||
] if "ble" not in FEATURES_AVAILABLE else []
|
||||
)
|
||||
SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/*.py',
|
||||
exclude=[
|
||||
SOURCE_PY_DIR + 'trezor/sdcard.py',
|
||||
|
12
core/src/ble.py
Normal file
12
core/src/ble.py
Normal file
@ -0,0 +1,12 @@
|
||||
import storage.device
|
||||
import trezorble as ble
|
||||
from trezor import log
|
||||
|
||||
try:
|
||||
ble.start_comm()
|
||||
|
||||
# allow connections from bonded peers if any
|
||||
if ble.peer_count() > 0:
|
||||
ble.start_advertising(True, storage.device.get_label())
|
||||
except Exception as e:
|
||||
log.exception(__name__, e)
|
@ -49,14 +49,9 @@ usb.bus.open(storage.device.get_device_id())
|
||||
|
||||
# enable BLE, allow connections
|
||||
if utils.USE_BLE:
|
||||
import trezorble as ble
|
||||
ble.start_comm()
|
||||
|
||||
# allow connections from bonded peers if any
|
||||
if ble.peer_count() > 0:
|
||||
ble.start_advertising(True, storage.device.get_label())
|
||||
|
||||
del ble
|
||||
with utils.unimport():
|
||||
import ble # noqa: F401
|
||||
del ble
|
||||
|
||||
|
||||
# run the endless loop
|
||||
|
Loading…
Reference in New Issue
Block a user