mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-26 08:08:51 +00:00
69ef1f0acd
Previously if an import of a dependent module (usb1, hid) failed, import of the whole transport module would fail. This was resolved by catching ImportErrors in the all_transports method. This had two drawbacks: - if something other than ImportError happened - e.g., libusb would raise OSError if it couldn't find libusb.so - all_transports would crash anyway - at the same time, if a legitimately needed dependency (typing_extensions) was missing, this would be masked by the ImportError handling. Instead, we unconditionally import the modules, and inside each one, wrap dependencies in a try-except. As an added benefit, it is now possible to disable a transport just by setting SomeTransport.ENABLED = False |
||
---|---|---|
.. | ||
__init__.py | ||
bridge.py | ||
hid.py | ||
protocol.py | ||
udp.py | ||
webusb.py |