Browse Source

use another lock for hid operations

283
ThomasV 9 years ago
parent
commit
49a5994b29
  1. 2
      lib/plugins.py
  2. 1
      plugins/trezor/plugin.py

2
lib/plugins.py

@ -307,6 +307,7 @@ class DeviceMgr(ThreadJob, PrintError):
self.recognised_hardware = set()
# For synchronization
self.lock = threading.RLock()
self.hid_lock = threading.RLock()
self.config = config
def thread_jobs(self):
@ -490,6 +491,7 @@ class DeviceMgr(ThreadJob, PrintError):
# wallet libraries are not affected.
import hid
self.print_error("scanning devices...")
with self.hid_lock:
hid_list = hid.enumerate(0, 0)
# First see what's connected that we know about
devices = []

1
plugins/trezor/plugin.py

@ -136,6 +136,7 @@ class TrezorCompatiblePlugin(HW_PluginBase):
assert self.main_thread != threading.current_thread()
devmgr = self.device_manager()
handler = keystore.handler
with devmgr.hid_lock:
client = devmgr.client_for_keystore(self, handler, keystore, force_pair)
# returns the client for a given keystore. can use xpub
if client:

Loading…
Cancel
Save