fix a bug with hw devices.
if a device is unplugged and then replugged before we notice (via scan_devices) then it will get into an unusable state, throwing all kinds of low level exceptions when we don't expect it. affects ledger, keepkey, dbb, but for some reason not trezor.
This commit is contained in:
@@ -57,6 +57,13 @@ class Ledger_Client():
|
||||
def i4b(self, x):
|
||||
return pack('>I', x)
|
||||
|
||||
def has_usable_connection_with_device(self):
|
||||
try:
|
||||
self.dongleObject.getFirmwareVersion()
|
||||
except BaseException:
|
||||
return False
|
||||
return True
|
||||
|
||||
def test_pin_unlocked(func):
|
||||
"""Function decorator to test the Ledger for being unlocked, and if not,
|
||||
raise a human-readable exception.
|
||||
@@ -513,13 +520,6 @@ class LedgerPlugin(HW_PluginBase):
|
||||
if self.libraries_available:
|
||||
self.device_manager().register_devices(self.DEVICE_IDS)
|
||||
|
||||
def btchip_is_connected(self, keystore):
|
||||
try:
|
||||
self.get_client(keystore).getFirmwareVersion()
|
||||
except Exception as e:
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_btchip_device(self, device):
|
||||
ledger = False
|
||||
if (device.product_key[0] == 0x2581 and device.product_key[1] == 0x3b7c) or (device.product_key[0] == 0x2581 and device.product_key[1] == 0x4b7c) or (device.product_key[0] == 0x2c97):
|
||||
|
||||
Reference in New Issue
Block a user