mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix for bug in windows detection of BeBook
This commit is contained in:
parent
aeae9e613a
commit
04d8e251c5
@ -47,8 +47,8 @@ class DeviceScanner(object):
|
||||
rev = ('rev_%4.4x'%c).replace('a', ':')
|
||||
if rev in device_id:
|
||||
return True
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
def test_bcd(self, bcdDevice, bcd):
|
||||
if bcd is None or len(bcd) == 0:
|
||||
return True
|
||||
@ -56,19 +56,20 @@ class DeviceScanner(object):
|
||||
if c == bcdDevice:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def is_device_connected(self, device):
|
||||
vendor_ids = device.VENDOR_ID if hasattr(device.VENDOR_ID, '__len__') else [device.VENDOR_ID]
|
||||
product_ids = device.PRODUCT_ID if hasattr(device.PRODUCT_ID, '__len__') else [device.PRODUCT_ID]
|
||||
if iswindows:
|
||||
for vendor_id, product_id in zip(vendor_ids, product_ids):
|
||||
vid, pid = 'vid_%4.4x'%vendor_id, 'pid_%4.4x'%product_id
|
||||
vidd, pidd = 'vid_%i'%vendor_id, 'pid_%i'%product_id
|
||||
for device_id in self.devices:
|
||||
if (vid in device_id or vidd in device_id) and (pid in device_id or pidd in device_id):
|
||||
if self.test_bcd_windows(device_id, getattr(device, 'BCD', None)):
|
||||
if device.can_handle(device_id):
|
||||
return True
|
||||
for vendor_id in vendor_ids:
|
||||
for product_id in product_ids:
|
||||
vid, pid = 'vid_%4.4x'%vendor_id, 'pid_%4.4x'%product_id
|
||||
vidd, pidd = 'vid_%i'%vendor_id, 'pid_%i'%product_id
|
||||
for device_id in self.devices:
|
||||
if (vid in device_id or vidd in device_id) and (pid in device_id or pidd in device_id):
|
||||
if self.test_bcd_windows(device_id, getattr(device, 'BCD', None)):
|
||||
if device.can_handle(device_id):
|
||||
return True
|
||||
else:
|
||||
for vendor, product, bcdDevice in self.devices:
|
||||
if vendor in vendor_ids and product in product_ids:
|
||||
|
Loading…
x
Reference in New Issue
Block a user