URI: 
       tDeviceMgr.scan_devices: do all scanning on hidapi thread - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit f265acd2348697170ec7d23af69ebb7af91de0e7
   DIR parent 6d86f4dc18faaafd9f184c97c3433ec3313c7d69
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Mon, 31 Aug 2020 22:17:44 +0200
       
       DeviceMgr.scan_devices: do all scanning on hidapi thread
       
       e.g. the trezor custom enumerate function calls hid.enumerate() which is not thread safe (?).
       see comment on line 330
       
       Diffstat:
         M electrum/plugin.py                  |       5 ++++-
       
       1 file changed, 4 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/electrum/plugin.py b/electrum/plugin.py
       t@@ -682,6 +682,7 @@ class DeviceMgr(ThreadJob):
                return devices
        
            @with_scan_lock
       +    @profiler
            def scan_devices(self) -> Sequence['Device']:
                self.logger.info("scanning devices...")
        
       t@@ -692,8 +693,10 @@ class DeviceMgr(ThreadJob):
                with self.lock:
                    enumerate_funcs = list(self._enumerate_func)
                for f in enumerate_funcs:
       +            # custom enumerate functions might use hidapi, so use hid thread to be safe
       +            new_devices_fut = _hid_executor.submit(f)
                    try:
       -                new_devices = f()
       +                new_devices = new_devices_fut.result()
                    except BaseException as e:
                        self.logger.error('custom device enum failed. func {}, error {}'
                                          .format(str(f), repr(e)))