def enumerate(self):
     # If there is a bridge, prefer that.
     # On Windows, the bridge runs as Admin (and Electrum usually does not),
     # so the bridge has better chances of finding devices. see #5420
     # This also avoids duplicate entries.
     if self.is_bridge_available():
         devices = BridgeTransport.enumerate()
     else:
         devices = trezorlib.transport.enumerate_devices()
     return [Device(path=d.get_path(),
                    interface_number=-1,
                    id_=d.get_path(),
                    product_key=TREZOR_PRODUCT_KEY,
                    usage_page=0,
                    transport_ui_string=d.get_path())
             for d in devices]
Exemple #2
0
def get_bridge_device() -> device:
    devices = BridgeTransport.enumerate()
    for d in devices:
        d.find_debug()
        return d
    raise RuntimeError("No debuggable bridge device found")