mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
sync to trunk
This commit is contained in:
commit
36f5acdfff
@ -43,6 +43,14 @@ class BEBOOK(USBMS):
|
|||||||
|
|
||||||
return drives
|
return drives
|
||||||
|
|
||||||
|
def linux_swap_drives(self, drives):
|
||||||
|
if len(drives) < 2: return drives
|
||||||
|
drives = list(drives)
|
||||||
|
t = drives[0]
|
||||||
|
drives[0] = drives[1]
|
||||||
|
drives[1] = t
|
||||||
|
return tuple(drives)
|
||||||
|
|
||||||
|
|
||||||
class BEBOOK_MINI(BEBOOK):
|
class BEBOOK_MINI(BEBOOK):
|
||||||
name = 'BeBook Mini driver'
|
name = 'BeBook Mini driver'
|
||||||
|
@ -217,7 +217,7 @@ def main():
|
|||||||
if command == "df":
|
if command == "df":
|
||||||
total = dev.total_space(end_session=False)
|
total = dev.total_space(end_session=False)
|
||||||
free = dev.free_space()
|
free = dev.free_space()
|
||||||
where = ("Memory", "Stick", "Card")
|
where = ("Memory", "Card A", "Card B")
|
||||||
print "Filesystem\tSize \tUsed \tAvail \tUse%"
|
print "Filesystem\tSize \tUsed \tAvail \tUse%"
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
print "%-10s\t%s\t%s\t%s\t%s"%(where[i], human_readable(total[i]), human_readable(total[i]-free[i]), human_readable(free[i]),\
|
print "%-10s\t%s\t%s\t%s\t%s"%(where[i], human_readable(total[i]), human_readable(total[i]-free[i]), human_readable(free[i]),\
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2009, John Schember <john at nachtimwald.com>'
|
__copyright__ = '''2009, John Schember <john at nachtimwald.com>
|
||||||
|
and Kovid Goyal <kovid@kovidgoyal.net>'''
|
||||||
'''
|
'''
|
||||||
Generic device driver. This is not a complete stand alone driver. It is
|
Generic device driver. This is not a complete stand alone driver. It is
|
||||||
intended to be subclassed with the relevant parts implemented for a particular
|
intended to be subclassed with the relevant parts implemented for a particular
|
||||||
@ -367,13 +368,21 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
if ok[node]:
|
if ok[node]:
|
||||||
devnodes.append(node)
|
devnodes.append(node)
|
||||||
devnodes += list(repeat(None, 3))
|
devnodes += list(repeat(None, 3))
|
||||||
return tuple(['/dev/'+x if ok.get(x, False) else None for x in devnodes[:3]])
|
ans = tuple(['/dev/'+x if ok.get(x, False) else None for x in devnodes[:3]])
|
||||||
|
return self.linux_swap_drives(ans)
|
||||||
|
|
||||||
|
def linux_swap_drives(self, drives):
|
||||||
|
return drives
|
||||||
|
|
||||||
def node_mountpoint(self, node):
|
def node_mountpoint(self, node):
|
||||||
|
|
||||||
|
def de_octal(raw):
|
||||||
|
return re.sub(r'\\0\d+', lambda m: chr(int(m.group()[1:], 8)), raw)
|
||||||
|
|
||||||
for line in open('/proc/mounts').readlines():
|
for line in open('/proc/mounts').readlines():
|
||||||
line = line.split()
|
line = line.split()
|
||||||
if line[0] == node:
|
if line[0] == node:
|
||||||
return line[1]
|
return de_octal(line[1])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def find_largest_partition(self, path):
|
def find_largest_partition(self, path):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user