mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for broken rev in pnp id for PRS 650
This commit is contained in:
parent
e2e93a3a74
commit
23a4481858
@ -408,7 +408,7 @@ _devid_pat = None
|
|||||||
def devid_pat():
|
def devid_pat():
|
||||||
global _devid_pat
|
global _devid_pat
|
||||||
if _devid_pat is None:
|
if _devid_pat is None:
|
||||||
_devid_pat = re.compile(r'VID_([a-f0-9]{4})&PID_([a-f0-9]{4})&REV_([a-f0-9]{4})', re.I)
|
_devid_pat = re.compile(r'VID_([a-f0-9]{4})&PID_([a-f0-9]{4})&REV_([a-f0-9:]{4})', re.I)
|
||||||
return _devid_pat
|
return _devid_pat
|
||||||
|
|
||||||
|
|
||||||
@ -646,6 +646,9 @@ class USBDevice(_USBDevice):
|
|||||||
return 'USBDevice(vendor_id=%s product_id=%s bcd=%s devid=%s devinst=%s)' % (
|
return 'USBDevice(vendor_id=%s product_id=%s bcd=%s devid=%s devinst=%s)' % (
|
||||||
r(self.vendor_id), r(self.product_id), r(self.bcd), self.devid, self.devinst)
|
r(self.vendor_id), r(self.product_id), r(self.bcd), self.devid, self.devinst)
|
||||||
|
|
||||||
|
def parse_hex(x):
|
||||||
|
return int(x.replace(':', 'a'), 16)
|
||||||
|
|
||||||
def iterusbdevices():
|
def iterusbdevices():
|
||||||
buf = None
|
buf = None
|
||||||
pat = devid_pat()
|
pat = devid_pat()
|
||||||
@ -658,7 +661,7 @@ def iterusbdevices():
|
|||||||
yield USBDevice(None, None, None, devid, devinfo.DevInst)
|
yield USBDevice(None, None, None, devid, devinfo.DevInst)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
vid, pid, bcd = map(lambda x:int(x, 16), m.group(1, 2, 3))
|
vid, pid, bcd = map(parse_hex, m.group(1, 2, 3))
|
||||||
except Exception:
|
except Exception:
|
||||||
yield USBDevice(None, None, None, devid, devinfo.DevInst)
|
yield USBDevice(None, None, None, devid, devinfo.DevInst)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user