1
0

hww hidapi usage: try to mitigate some thread-safety issues

related: #6097
This commit is contained in:
SomberNight
2020-04-17 19:05:56 +02:00
parent 98d2ab5bd6
commit 2cfa3bd6c8
6 changed files with 66 additions and 25 deletions

View File

@@ -77,10 +77,11 @@ class DigitalBitbox_Client(HardwareClientBase):
def close(self):
if self.opened:
try:
self.dbb_hid.close()
except:
pass
with self.device_manager().hid_lock:
try:
self.dbb_hid.close()
except:
pass
self.opened = False
@@ -681,8 +682,9 @@ class DigitalBitboxPlugin(HW_PluginBase):
def get_dbb_device(self, device):
dev = hid.device()
dev.open_path(device.path)
with self.device_manager().hid_lock:
dev = hid.device()
dev.open_path(device.path)
return dev