From 278f36970befdf1a04dbe2959ecc43c9d5d869a7 Mon Sep 17 00:00:00 2001 From: "Peter D. Gray" Date: Mon, 29 Apr 2019 10:51:33 -0400 Subject: [PATCH] commands.py: use fingerprint if already captured by client --- hwilib/commands.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hwilib/commands.py b/hwilib/commands.py index f55ecb9..a420467 100644 --- a/hwilib/commands.py +++ b/hwilib/commands.py @@ -48,8 +48,12 @@ def find_device(device_path, password='', device_type=None, fingerprint=None): client = None try: client = get_client(d['type'], d['path'], password) - master_xpub = client.get_pubkey_at_path('m/0h')['xpub'] - master_fpr = get_xpub_fingerprint_hex(master_xpub) + + master_fpr = d.get('fingerprint', None) + if master_fpr is None: + master_xpub = client.get_pubkey_at_path('m/0h')['xpub'] + master_fpr = get_xpub_fingerprint_hex(master_xpub) + if fingerprint and master_fpr != fingerprint: client.close() continue