aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Harddisk.py
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2009-12-22 16:08:21 +0100
committerghost <andreas.monzner@multimedia-labs.de>2009-12-22 16:08:21 +0100
commit4e8904ef73e3ce5e275a1f5fbf369c4f9dab648e (patch)
treeccb69c79af9e5624085f1db845e6223f81f1c69f /lib/python/Components/Harddisk.py
parentf901175ad6e72c60f0916c6ba6edcbdad7dbf5ec (diff)
parentd2188eb11a8c7663e34b1ab3d343a9981e60da62 (diff)
downloadenigma2-4e8904ef73e3ce5e275a1f5fbf369c4f9dab648e.tar.gz
enigma2-4e8904ef73e3ce5e275a1f5fbf369c4f9dab648e.zip
Merge branch 'bug_236_recordpath'
Diffstat (limited to 'lib/python/Components/Harddisk.py')
-rwxr-xr-xlib/python/Components/Harddisk.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/python/Components/Harddisk.py b/lib/python/Components/Harddisk.py
index 2efdb68f..03f574f3 100755
--- a/lib/python/Components/Harddisk.py
+++ b/lib/python/Components/Harddisk.py
@@ -290,7 +290,10 @@ class Harddisk:
# any access has been made to the disc. If there has been no access over a specifed time,
# we set the hdd into standby.
def readStats(self):
- l = readFile("/sys/block/%s/stat" % self.device)
+ try:
+ l = open("/sys/block/%s/stat" % self.device).read()
+ except IOError:
+ return -1,-1
(nr_read, _, _, _, nr_write) = l.split()[:5]
return int(nr_read), int(nr_write)
@@ -319,7 +322,7 @@ class Harddisk:
l = sum(stats)
print "sum", l, "prev_sum", self.last_stat
- if l != self.last_stat: # access
+ if l != self.last_stat and l >= 0: # access
print "hdd was accessed since previous check!"
self.last_stat = l
self.last_access = t