return (res >> 8)
def mount(self):
- cmd = "/bin/mount -t ext3 " + self.devidex + "part1"
- res = system(cmd)
- return (res >> 8)
+ res = -1
+ #we don't know which type of devicename is used in fstab, try both
+ for device in [self.devidex, self.devidex2]:
+ cmd = "/bin/mount -t ext3 " + device + "part1"
+ res = system(cmd)
+ res >>= 8
+ if not res:
+ break
+ return res
def createMovieFolder(self):
try:
# we set the hdd into standby.
def readStats(self):
l = open("/sys/block/%s/stat" % self.device).read()
- nr_read = int(l[:8].strip())
- nr_write = int(l[4*9:4*9+8].strip())
- return nr_read, nr_write
+ (nr_read, _, _, _, nr_write) = l.split()[:5]
+ return int(nr_read), int(nr_write)
def startIdle(self):
self.last_access = time.time()
self.on_partition_list_change("remove", x)
l = len(device)
if l and not device[l-1].isdigit():
- idx = 0
for hdd in self.hdd:
if hdd.device == device:
- self.hdd[x].stop()
- del self.hdd[idx]
+ hdd.stop()
+ self.hdd.remove(hdd)
break
SystemInfo["Harddisk"] = len(self.hdd) > 0