diff options
| author | Ronny Strutz <ronny.strutz@multimedia-labs.de> | 2005-08-29 22:00:47 +0000 |
|---|---|---|
| committer | Ronny Strutz <ronny.strutz@multimedia-labs.de> | 2005-08-29 22:00:47 +0000 |
| commit | b29f0af566c8c1fd25de259ba35f5130a7efe8ca (patch) | |
| tree | 3f615e046e76284c8520d7ebc0024e841b04051c /lib/python/Components/Harddisk.py | |
| parent | a434abbb775f2b4083ab0c7a7570ec14bd1cbce9 (diff) | |
| download | enigma2-b29f0af566c8c1fd25de259ba35f5130a7efe8ca.tar.gz enigma2-b29f0af566c8c1fd25de259ba35f5130a7efe8ca.zip | |
add harddisk stuff
Diffstat (limited to 'lib/python/Components/Harddisk.py')
| -rw-r--r-- | lib/python/Components/Harddisk.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py new file mode 100644 index 00000000..a09073ba --- /dev/null +++ b/lib/python/Components/Harddisk.py @@ -0,0 +1,44 @@ + + +def tryOpen(filename): + try: + procFile = open(filename) + except IOError: + return "" + return procFile + +class Harddisk: + def __init__(self, index): + self.index = index + #perhaps this is easier? + self.prochdx = "/proc/ide/hd" + ("a","b","c","d","e","f","g","h")[index] + "/" + + def capacity(self): + procfile = tryOpen(self.prochdx + "capacity") + + if procfile == "": + return -1 + + line = procfile.readline() + procfile.close() + + if line == "": + return -1 + + return int(line) + + def model(self): + procfile = tryOpen(self.prochdx + "model") + + if procfile == "": + return "" + + line = procfile.readline() + procfile.close() + + return line + + def free(self): + pass + +
\ No newline at end of file |
