mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
2815d05ccc
commit
dc83803252
@ -87,6 +87,7 @@ def migrate(old, new):
|
||||
print 'Database migrated to', os.path.abspath(new)
|
||||
|
||||
def debug_device_driver():
|
||||
from calibre.customize.ui import device_plugins
|
||||
from calibre.devices.scanner import DeviceScanner
|
||||
s = DeviceScanner()
|
||||
s.scan()
|
||||
@ -113,17 +114,15 @@ def debug_device_driver():
|
||||
raw = Device.run_ioreg()
|
||||
open('/tmp/ioreg.txt', 'wb').write(raw)
|
||||
print 'ioreg output saved to /tmp/ioreg.txt'
|
||||
from calibre.devices import devices
|
||||
for dev in devices():
|
||||
print 'Looking for', dev.__name__
|
||||
for dev in device_plugins():
|
||||
print 'Looking for', dev.__class__.__name__
|
||||
connected = s.is_device_connected(dev)
|
||||
if connected:
|
||||
print 'Device Connected:', dev
|
||||
print 'Trying to open device...'
|
||||
d = dev()
|
||||
d.open()
|
||||
print 'Main memory:', repr(d._main_prefix)
|
||||
print 'Total space:', d.total_space()
|
||||
dev.open()
|
||||
print 'Main memory:', repr(dev._main_prefix)
|
||||
print 'Total space:', dev.total_space()
|
||||
break
|
||||
|
||||
def add_simple_plugin(path_to_plugin):
|
||||
|
@ -342,6 +342,7 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
break
|
||||
else:
|
||||
break
|
||||
|
||||
if usb_dir is None:
|
||||
raise DeviceError(_('Unable to detect the %s disk drive.')
|
||||
%self.__class__.__name__)
|
||||
@ -363,8 +364,8 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
ok[node] = False
|
||||
except:
|
||||
ok[node] = False
|
||||
devnodes.append(node)
|
||||
devnodes.sort()
|
||||
if ok[node]:
|
||||
devnodes.append(node)
|
||||
devnodes += list(repeat(None, 3))
|
||||
return tuple(['/dev/'+x if ok.get(x, False) else None for x in devnodes[:3]])
|
||||
|
||||
@ -459,7 +460,6 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
setattr(self, prefix, mp)
|
||||
prefix, typ = '_card_b_prefix', 'cardb'
|
||||
|
||||
|
||||
def open(self):
|
||||
time.sleep(5)
|
||||
self._main_prefix = self._card_a_prefix = self._card_b_prefix = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user