mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1641 (4.129 crashes when Reader device is attached)
This commit is contained in:
parent
e1c4e0bd45
commit
7fb663e048
@ -146,36 +146,7 @@ class PRS505(Device):
|
|||||||
self._card_prefix = re.search(card_pat, mount).group(2) + os.sep
|
self._card_prefix = re.search(card_pat, mount).group(2) + os.sep
|
||||||
|
|
||||||
|
|
||||||
def open_windows_nowmi(self):
|
|
||||||
from calibre import plugins
|
|
||||||
winutil = plugins['winutil'][0]
|
|
||||||
volumes = winutil.get_mounted_volumes_for_usb_device(self.VENDOR_ID, self.PRODUCT_ID)
|
|
||||||
main = None
|
|
||||||
for device_id in volumes.keys():
|
|
||||||
if 'PRS-505/UC&' in device_id:
|
|
||||||
main = volumes[device_id]+':\\'
|
|
||||||
if not main:
|
|
||||||
raise DeviceError(_('Unable to detect the %s disk drive. Try rebooting.')%self.__class__.__name__)
|
|
||||||
self._main_prefix = main
|
|
||||||
card = self._card_prefix = None
|
|
||||||
win32api = __import__('win32api')
|
|
||||||
for device_id in volumes.keys():
|
|
||||||
if 'PRS-505/UC:' in device_id:
|
|
||||||
card = volumes[device_id]+':\\'
|
|
||||||
try:
|
|
||||||
win32api.GetVolumeInformation(card)
|
|
||||||
self._card_prefix = card
|
|
||||||
break
|
|
||||||
except:
|
|
||||||
continue
|
|
||||||
|
|
||||||
|
|
||||||
def open_windows(self):
|
def open_windows(self):
|
||||||
try:
|
|
||||||
self.open_windows_nowmi()
|
|
||||||
return
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
drives = []
|
drives = []
|
||||||
wmi = __import__('wmi', globals(), locals(), [], -1)
|
wmi = __import__('wmi', globals(), locals(), [], -1)
|
||||||
c = wmi.WMI()
|
c = wmi.WMI()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user