sync to trunk

This commit is contained in:
John Schember 2009-06-03 20:19:49 -04:00
commit 36f5acdfff
3 changed files with 21 additions and 4 deletions

View File

@ -43,6 +43,14 @@ class BEBOOK(USBMS):
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):
name = 'BeBook Mini driver'

View File

@ -217,7 +217,7 @@ def main():
if command == "df":
total = dev.total_space(end_session=False)
free = dev.free_space()
where = ("Memory", "Stick", "Card")
where = ("Memory", "Card A", "Card B")
print "Filesystem\tSize \tUsed \tAvail \tUse%"
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]),\

View File

@ -1,5 +1,6 @@
__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
intended to be subclassed with the relevant parts implemented for a particular
@ -367,13 +368,21 @@ class Device(DeviceConfig, DevicePlugin):
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]])
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 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():
line = line.split()
if line[0] == node:
return line[1]
return de_octal(line[1])
return None
def find_largest_partition(self, path):