1
0

trezor: don't let bridge transport failing block all other transports

[trezor] connecting to device at bridge:hid...
[trezor] connected to device at bridge:hid...
Traceback (most recent call last):
  File "...\electrum\electrum\base_wizard.py", line 255, in choose_hw_device
    u = devmgr.unpaired_device_infos(None, plugin, devices=scanned_devices)
  File "...\electrum\electrum\plugin.py", line 501, in unpaired_device_infos
    client = self.create_client(device, handler, plugin)
  File "...\electrum\electrum\plugin.py", line 374, in create_client
    client = plugin.create_client(device, handler)
  File "...\electrum\electrum\plugins\trezor\trezor.py", line 124, in create_client
    client = self.client_class(transport, handler, self)
  File "...\electrum\electrum\plugins\trezor\client.py", line 7, in __init__
    ProtocolMixin.__init__(self, transport=transport)
  File "...\Python36-32\lib\site-packages\trezorlib\client.py", line 444, in __init__
    self.init_device()
  File "...\Python36-32\lib\site-packages\trezorlib\client.py", line 454, in init_device
    self.features = expect(proto.Features)(self.call)(init_msg)
  File "...\Python36-32\lib\site-packages\trezorlib\client.py", line 115, in wrapped_f
    ret = f(*args, **kwargs)
  File "...\Python36-32\lib\site-packages\trezorlib\client.py", line 129, in wrapped_f
    client.transport.session_begin()
  File "...\Python36-32\lib\site-packages\trezorlib\transport\__init__.py", line 42, in session_begin
    self.open()
  File "...\Python36-32\lib\site-packages\trezorlib\transport\bridge.py", line 69, in open
    raise TransportException('trezord: Could not acquire session' + get_error(r))
trezorlib.transport.TransportException: trezord: Could not acquire session (error=400 str=wrong previous session)
[DeviceMgr] error getting device infos for trezor: trezord: Could not acquire session (error=400 str=wrong previous session)
This commit is contained in:
SomberNight
2018-11-08 17:07:05 +01:00
parent 47b6d3c52c
commit dace2e5495
3 changed files with 15 additions and 4 deletions

View File

@@ -485,7 +485,7 @@ class DeviceMgr(ThreadJob, PrintError):
'its seed (and passphrase, if any). Otherwise all bitcoins you '
'receive will be unspendable.').format(plugin.device))
def unpaired_device_infos(self, handler, plugin, devices=None):
def unpaired_device_infos(self, handler, plugin: 'HW_PluginBase', devices=None):
'''Returns a list of DeviceInfo objects: one for each connected,
unpaired device accepted by the plugin.'''
if not plugin.libraries_available:
@@ -498,7 +498,11 @@ class DeviceMgr(ThreadJob, PrintError):
for device in devices:
if device.product_key not in plugin.DEVICE_IDS:
continue
client = self.create_client(device, handler, plugin)
try:
client = self.create_client(device, handler, plugin)
except BaseException as e:
self.print_error(f'failed to create client for {plugin.name} at {device.path}: {repr(e)}')
continue
if not client:
continue
infos.append(DeviceInfo(device, client.label(), client.is_initialized()))