mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Debug output for mount point detection on linux
This commit is contained in:
parent
6830bbdfe1
commit
472833d9ab
@ -15,6 +15,7 @@ import os, subprocess, time, re, sys, glob
|
|||||||
from itertools import repeat
|
from itertools import repeat
|
||||||
|
|
||||||
from calibre import prints, as_unicode
|
from calibre import prints, as_unicode
|
||||||
|
from calibre.constants import DEBUG
|
||||||
from calibre.devices.interface import DevicePlugin
|
from calibre.devices.interface import DevicePlugin
|
||||||
from calibre.devices.errors import DeviceError
|
from calibre.devices.errors import DeviceError
|
||||||
from calibre.devices.usbms.deviceconfig import DeviceConfig
|
from calibre.devices.usbms.deviceconfig import DeviceConfig
|
||||||
@ -615,6 +616,8 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
'the device has already been ejected, or your '
|
'the device has already been ejected, or your '
|
||||||
'kernel is exporting a deprecated version of SYSFS.')
|
'kernel is exporting a deprecated version of SYSFS.')
|
||||||
%self.__class__.__name__)
|
%self.__class__.__name__)
|
||||||
|
if DEBUG:
|
||||||
|
print '\nFound device nodes:', main, carda, cardb
|
||||||
|
|
||||||
self._linux_mount_map = {}
|
self._linux_mount_map = {}
|
||||||
mp, ret = mount(main, 'main')
|
mp, ret = mount(main, 'main')
|
||||||
@ -659,6 +662,8 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
os.remove(path)
|
os.remove(path)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
if DEBUG and ro:
|
||||||
|
print '\nThe mountpoint', mp, 'is readonly, ignoring it'
|
||||||
return ro
|
return ro
|
||||||
|
|
||||||
for mp in ('_main_prefix', '_card_a_prefix', '_card_b_prefix'):
|
for mp in ('_main_prefix', '_card_a_prefix', '_card_b_prefix'):
|
||||||
@ -722,7 +727,7 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
d.serial == objif.GetProperty('usb.serial'):
|
d.serial == objif.GetProperty('usb.serial'):
|
||||||
dpaths = manager.FindDeviceStringMatch('storage.originating_device', path)
|
dpaths = manager.FindDeviceStringMatch('storage.originating_device', path)
|
||||||
for dpath in dpaths:
|
for dpath in dpaths:
|
||||||
#devif = dbus.Interface(bus.get_object('org.freedesktop.Hal', dpath), 'org.freedesktop.Hal.Device')
|
# devif = dbus.Interface(bus.get_object('org.freedesktop.Hal', dpath), 'org.freedesktop.Hal.Device')
|
||||||
try:
|
try:
|
||||||
vpaths = manager.FindDeviceStringMatch('block.storage_device', dpath)
|
vpaths = manager.FindDeviceStringMatch('block.storage_device', dpath)
|
||||||
for vpath in vpaths:
|
for vpath in vpaths:
|
||||||
@ -740,13 +745,13 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
'vol': volif,
|
'vol': volif,
|
||||||
'label': vdevif.GetProperty('volume.label')}
|
'label': vdevif.GetProperty('volume.label')}
|
||||||
vols.append(vol)
|
vols.append(vol)
|
||||||
except dbus.exceptions.DBusException, e:
|
except dbus.exceptions.DBusException as e:
|
||||||
print e
|
print e
|
||||||
continue
|
continue
|
||||||
except dbus.exceptions.DBusException, e:
|
except dbus.exceptions.DBusException as e:
|
||||||
print e
|
print e
|
||||||
continue
|
continue
|
||||||
except dbus.exceptions.DBusException, e:
|
except dbus.exceptions.DBusException as e:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def ocmp(x,y):
|
def ocmp(x,y):
|
||||||
@ -779,7 +784,7 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
print "ERROR: Timeout waiting for mount to complete"
|
print "ERROR: Timeout waiting for mount to complete"
|
||||||
continue
|
continue
|
||||||
mp = vol['dev'].GetProperty('volume.mount_point')
|
mp = vol['dev'].GetProperty('volume.mount_point')
|
||||||
except dbus.exceptions.DBusException, e:
|
except dbus.exceptions.DBusException as e:
|
||||||
print "Failed to mount ", e
|
print "Failed to mount ", e
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -828,7 +833,7 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
print "FBSD: umount main:", self._main_prefix
|
print "FBSD: umount main:", self._main_prefix
|
||||||
try:
|
try:
|
||||||
self._main_vol.Unmount([])
|
self._main_vol.Unmount([])
|
||||||
except dbus.exceptions.DBusException, e:
|
except dbus.exceptions.DBusException as e:
|
||||||
print 'Unable to eject ', e
|
print 'Unable to eject ', e
|
||||||
|
|
||||||
if self._card_a_prefix:
|
if self._card_a_prefix:
|
||||||
@ -836,7 +841,7 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
print "FBSD: umount card a:", self._card_a_prefix
|
print "FBSD: umount card a:", self._card_a_prefix
|
||||||
try:
|
try:
|
||||||
self._card_a_vol.Unmount([])
|
self._card_a_vol.Unmount([])
|
||||||
except dbus.exceptions.DBusException, e:
|
except dbus.exceptions.DBusException as e:
|
||||||
print 'Unable to eject ', e
|
print 'Unable to eject ', e
|
||||||
|
|
||||||
if self._card_b_prefix:
|
if self._card_b_prefix:
|
||||||
@ -844,7 +849,7 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
print "FBSD: umount card b:", self._card_b_prefix
|
print "FBSD: umount card b:", self._card_b_prefix
|
||||||
try:
|
try:
|
||||||
self._card_b_vol.Unmount([])
|
self._card_b_vol.Unmount([])
|
||||||
except dbus.exceptions.DBusException, e:
|
except dbus.exceptions.DBusException as e:
|
||||||
print 'Unable to eject ', e
|
print 'Unable to eject ', e
|
||||||
|
|
||||||
self._main_prefix = None
|
self._main_prefix = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user