X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/64a7bd679d0a4a91699b8de9629b7c20de2fa5d7..b3135c06dd527e0ed65b6ffa921f830132f7d8b9:/lib/python/Components/Harddisk.py diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py index e0b66872..febd16dd 100644 --- a/lib/python/Components/Harddisk.py +++ b/lib/python/Components/Harddisk.py @@ -19,20 +19,22 @@ class Harddisk: s_minor = int(tmp[1]) for disc in listdir("/dev/discs"): path = readlink('/dev/discs/'+disc) - devidex = '/dev'+path[2:]+'/' - disc = devidex+'disc' + devidex = '/dev/discs/'+disc+'/' + devidex2 = '/dev'+path[2:]+'/' + disc = devidex2+'disc' ret = stat(disc).st_rdev if s_major == major(ret) and s_minor == minor(ret): self.devidex = devidex - print "new Harddisk", device, self.devidex + self.devidex2 = devidex2 + print "new Harddisk", device, '->', self.devidex, '->', self.devidex2 break def __lt__(self, ob): return self.device < ob.device def bus(self): - ide_cf = self.device.find("hd") == 0 and self.devidex.find("host0") == -1 # 7025 specific - internal = self.device.find("hd") == 0 and self.devidex + ide_cf = self.device.find("hd") == 0 and self.devidex2.find("host0") == -1 # 7025 specific + internal = self.device.find("hd") == 0 if ide_cf: ret = "External (CF)" elif internal: @@ -203,6 +205,12 @@ class Harddisk: return -3 return 0 + + def getDeviceDir(self): + return self.devidex + + def getDeviceName(self): + return self.getDeviceDir() + "disc" class Partition: def __init__(self, mountpoint, description = "", force_mounted = False): @@ -242,7 +250,7 @@ class Partition: class HarddiskManager: def __init__(self): self.hdd = [ ] - + self.cd = "" self.partitions = [ ] self.on_partition_list_change = CList() @@ -295,6 +303,8 @@ class HarddiskManager: if partition[0:len(blockdev)] != blockdev: continue partitions.append(partition) + else: + self.cd = blockdev except IOError: error = True return error, blacklisted, removable, is_cdrom, partitions @@ -355,9 +365,11 @@ class HarddiskManager: if cap != "": hdd += " (" + cap + ")" list.append((hdd, hd)) - print "list", list return list + def getCD(self): + return self.cd + def getMountedPartitions(self, onlyhotplug = False): return [x for x in self.partitions if (x.is_hotplug or not onlyhotplug) and x.mounted()]