From 2bd9f63f29248eba346c22eeb691977591d24069 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 19 Oct 2010 16:53:51 -0600 Subject: [PATCH] Linux device mounting: Mount the drive with the lowest kernel name as main memory --- src/calibre/devices/prs505/sony_cache.py | 6 +++--- src/calibre/devices/usbms/device.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/calibre/devices/prs505/sony_cache.py b/src/calibre/devices/prs505/sony_cache.py index e272cd6372..15245d3cd5 100644 --- a/src/calibre/devices/prs505/sony_cache.py +++ b/src/calibre/devices/prs505/sony_cache.py @@ -97,8 +97,8 @@ class XMLCache(object): for source_id, path in paths.items(): if source_id == 0: if not os.path.exists(path): - raise DeviceError('The SONY XML cache media.xml does not exist. Try' - ' disconnecting and reconnecting your reader.') + raise DeviceError(('The SONY XML cache %r does not exist. Try' + ' disconnecting and reconnecting your reader.')%repr(path)) with open(path, 'rb') as f: raw = f.read() else: @@ -112,7 +112,7 @@ class XMLCache(object): verbose=DEBUG)[0], parser=parser) if self.roots[source_id] is None: - raise Exception(('The SONY database at %s is corrupted. Try ' + raise Exception(('The SONY database at %r is corrupted. Try ' ' disconnecting and reconnecting your reader.')%path) self.ext_paths, self.ext_roots = {}, {} diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index 6f938cbcbd..aa4f0d06f4 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -523,7 +523,8 @@ class Device(DeviceConfig, DevicePlugin): devnodes.append(node) devnodes += list(repeat(None, 3)) - ans = tuple(['/dev/'+x if ok.get(x, False) else None for x in devnodes[:3]]) + ans = ['/dev/'+x if ok.get(x, False) else None for x in devnodes[:3]] + ans.sort(key=lambda x: x[5:] if x else 'zzzzz') return self.linux_swap_drives(ans) def linux_swap_drives(self, drives):