aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
authorRonny Strutz <ronny.strutz@multimedia-labs.de>2005-08-29 23:10:30 +0000
committerRonny Strutz <ronny.strutz@multimedia-labs.de>2005-08-29 23:10:30 +0000
commit40ece0a3e5031cf2738907734359ec9e27dcd6c7 (patch)
tree2f246f1082402d08dac5d775070262a819357e64 /lib/python/Components
parent567412adf1ace2dac175a2f206eef40191f06761 (diff)
downloadenigma2-40ece0a3e5031cf2738907734359ec9e27dcd6c7.tar.gz
enigma2-40ece0a3e5031cf2738907734359ec9e27dcd6c7.zip
add numPartitions
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/Harddisk.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py
index 708bb62e..663d0a00 100644
--- a/lib/python/Components/Harddisk.py
+++ b/lib/python/Components/Harddisk.py
@@ -17,7 +17,7 @@ class Harddisk:
#perhaps this is easier?
self.prochdx = "/proc/ide/hd" + ("a","b","c","d","e","f","g","h")[index] + "/"
- self.devidex = "/dev/ide/host" + str(host) + "/bus" + str(bus) + "/target" + str(target) + "/lun0/"
+ self.devidex = "/dev/ide/host" + str(host) + "/bus" + str(bus) + "/target" + str(target) + "/lun8/"
def capacity(self):
procfile = tryOpen(self.prochdx + "capacity")
@@ -67,3 +67,16 @@ class Harddisk:
break
procfile.close()
return free
+
+ def numPartitions(self):
+ try:
+ idedir = os.listdir(self.devidex)
+ except OSError:
+ return -1
+ numPart = -1
+ for filename in idedir:
+ if filename.startswith("disc"):
+ numPart += 1
+ if filename.startswith("part"):
+ numPart += 1
+ return numPart