hidapi: retry open several times with short wait to allow for delay in setting up permissions
This commit is contained in:
parent
444fd4aaf6
commit
c86d4be0fe
|
@ -322,7 +322,19 @@ def open_path(device_path):
|
|||
"""
|
||||
assert device_path
|
||||
assert device_path.startswith('/dev/hidraw')
|
||||
|
||||
_log.info('OPEN PATH %s', device_path)
|
||||
retrycount = 0
|
||||
while (retrycount < 3):
|
||||
retrycount += 1
|
||||
try:
|
||||
return _os.open(device_path, _os.O_RDWR | _os.O_SYNC)
|
||||
except OSError as e:
|
||||
_log.info('OPEN PATH FAILED %s ERROR %s %s', device_path, e.errno, e)
|
||||
if e.errno == _errno.EACCES:
|
||||
sleep(0.1)
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def close(device_handle):
|
||||
|
|
Loading…
Reference in New Issue