From 74bbfe822e7b32ea9470b0ee568cb3948a70af3f Mon Sep 17 00:00:00 2001 From: BTChip github Date: Mon, 12 Mar 2018 17:59:11 +0100 Subject: [PATCH 1/2] Fix multioutput detection --- btchip/btchip.py | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/btchip/btchip.py b/btchip/btchip.py index 0974799..938a884 100644 --- a/btchip/btchip.py +++ b/btchip/btchip.py @@ -79,8 +79,8 @@ def __init__(self, dongle): self.dongle = dongle self.needKeyCache = False try: - firmware = self.getFirmwareVersion()['version'].split(".") - self.multiOutputSupported = int(firmware[0]) >= 1 and int(firmware[1]) >= 1 and int(firmware[2]) >= 4 + firmware = self.getFirmwareVersion()['version'] + self.multiOutputSupported = tuple(map(int, (firmware.split(".")))) >= (1, 1, 4) if self.multiOutputSupported: self.scriptBlockLength = 50 else: diff --git a/setup.py b/setup.py index fc13eea..b04151a 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ here = dirname(__file__) setup( name='btchip-python', - version='0.1.24', + version='0.1.25', author='BTChip', author_email='hello@ledger.fr', description='Python library to communicate with Ledger Nano dongle', From 6e985b558f22d1fc0367f5c1730822750337cf94 Mon Sep 17 00:00:00 2001 From: BTChip github Date: Mon, 12 Mar 2018 19:27:29 +0100 Subject: [PATCH 2/2] Support multi-interface application --- btchip/btchipComm.py | 5 +++-- setup.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/btchip/btchipComm.py b/btchip/btchipComm.py index 060ed83..a88e248 100644 --- a/btchip/btchipComm.py +++ b/btchip/btchipComm.py @@ -220,8 +220,9 @@ def getDongle(debug=False): hidDevicePath = hidDevice['path'] ledger = True if hidDevice['vendor_id'] == 0x2c97: - hidDevicePath = hidDevice['path'] - ledger = True + if ('interface_number' in hidDevice and hidDevice['interface_number'] == 0) or ('usage_page' in hidDevice and hidDevice['usage_page'] == 0xffa0): + hidDevicePath = hidDevice['path'] + ledger = True if hidDevice['vendor_id'] == 0x2581 and hidDevice['product_id'] == 0x1807: hidDevicePath = hidDevice['path'] if hidDevicePath is not None: diff --git a/setup.py b/setup.py index b04151a..5c726f3 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ here = dirname(__file__) setup( name='btchip-python', - version='0.1.25', + version='0.1.26', author='BTChip', author_email='hello@ledger.fr', description='Python library to communicate with Ledger Nano dongle',