Merge branch 'usbms-device-walk-loop-fix' of https://github.com/shastry/calibre into master

This commit is contained in:
Kovid Goyal 2020-09-20 14:45:43 +05:30
commit ec3110920b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -466,6 +466,8 @@ class Device(DeviceConfig, DevicePlugin):
for y in ('idProduct', 'idVendor', 'bcdDevice'):
if not os.access(j(usb_dir, y), os.R_OK):
usb_dir = None
break
if usb_dir is None:
continue
e = lambda q : raw2num(open(j(usb_dir, q), 'rb').read().decode('utf-8'))
ven, prod, bcd = map(e, ('idVendor', 'idProduct', 'bcdDevice'))