use another lock for hid operations
This commit is contained in:
parent
82a33bf89e
commit
49a5994b29
|
@ -307,6 +307,7 @@ class DeviceMgr(ThreadJob, PrintError):
|
||||||
self.recognised_hardware = set()
|
self.recognised_hardware = set()
|
||||||
# For synchronization
|
# For synchronization
|
||||||
self.lock = threading.RLock()
|
self.lock = threading.RLock()
|
||||||
|
self.hid_lock = threading.RLock()
|
||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
def thread_jobs(self):
|
def thread_jobs(self):
|
||||||
|
@ -490,7 +491,8 @@ class DeviceMgr(ThreadJob, PrintError):
|
||||||
# wallet libraries are not affected.
|
# wallet libraries are not affected.
|
||||||
import hid
|
import hid
|
||||||
self.print_error("scanning devices...")
|
self.print_error("scanning devices...")
|
||||||
hid_list = hid.enumerate(0, 0)
|
with self.hid_lock:
|
||||||
|
hid_list = hid.enumerate(0, 0)
|
||||||
# First see what's connected that we know about
|
# First see what's connected that we know about
|
||||||
devices = []
|
devices = []
|
||||||
for d in hid_list:
|
for d in hid_list:
|
||||||
|
|
|
@ -136,7 +136,8 @@ class TrezorCompatiblePlugin(HW_PluginBase):
|
||||||
assert self.main_thread != threading.current_thread()
|
assert self.main_thread != threading.current_thread()
|
||||||
devmgr = self.device_manager()
|
devmgr = self.device_manager()
|
||||||
handler = keystore.handler
|
handler = keystore.handler
|
||||||
client = devmgr.client_for_keystore(self, handler, keystore, force_pair)
|
with devmgr.hid_lock:
|
||||||
|
client = devmgr.client_for_keystore(self, handler, keystore, force_pair)
|
||||||
# returns the client for a given keystore. can use xpub
|
# returns the client for a given keystore. can use xpub
|
||||||
if client:
|
if client:
|
||||||
client.used()
|
client.used()
|
||||||
|
|
Loading…
Reference in New Issue