electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit f4fa53e915e12cf21f8202e194206c47e0180bc4
parent f8ed7b058dae25a345160333da916b15a472cf5c
Author: Neil Booth <kyuupichan@gmail.com>
Date:   Sun, 24 Jan 2016 14:31:43 +0900

Trezor: fixes for latest libtrezor

We were relying on internals of libtrezor that they just
changed.  However their changes don't work on Mac either.
Work around both issues.  I think this...

Fixes #1637

Diffstat:
Mlib/plugins.py | 6+++---
Mplugins/trezor/plugin.py | 12+++++++-----
2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lib/plugins.py b/lib/plugins.py @@ -227,7 +227,7 @@ class BasePlugin(PrintError): def settings_dialog(self): pass -Device = namedtuple("Device", "path id_ product_key") +Device = namedtuple("Device", "path interface_number id_ product_key") DeviceInfo = namedtuple("DeviceInfo", "device description initialized") class DeviceMgr(PrintError): @@ -423,8 +423,8 @@ class DeviceMgr(PrintError): for d in hid.enumerate(0, 0): product_key = (d['vendor_id'], d['product_id']) if product_key in self.recognised_hardware: - devices.append(Device(d['path'], d['serial_number'], - product_key)) + devices.append(Device(d['path'], d['interface_number'], + d['serial_number'], product_key)) # Now find out what was disconnected pairs = [(dev.path, dev.id_) for dev in devices] diff --git a/plugins/trezor/plugin.py b/plugins/trezor/plugin.py @@ -209,16 +209,18 @@ class TrezorCompatiblePlugin(BasePlugin, ThreadJob): wallet.last_operation = self.prevent_timeout def create_client(self, device, handler): - path = device.path - pair = ((None, path) if self.HidTransport._detect_debuglink(path) - else (path, None)) + if device.interface_number == 1: + pair = [None, device.path] + else: + pair = [device.path, None] + try: transport = self.HidTransport(pair) except BaseException as e: # We were probably just disconnected; never mind - self.print_error("cannot connect at", path, str(e)) + self.print_error("cannot connect at", device.path, str(e)) return None - self.print_error("connected to device at", path) + self.print_error("connected to device at", device.path) client = self.client_class(transport, handler, self)