aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Harddisk.py
diff options
context:
space:
mode:
authorthedoc <thedoc@atom.(none)>2009-12-23 11:24:17 +0100
committerthedoc <thedoc@atom.(none)>2009-12-23 11:24:17 +0100
commitbc8b453f3e2a5a142faa23efdb777165b33e788d (patch)
tree12da09e98d3fbbfdee25d133a40015fb7665e789 /lib/python/Components/Harddisk.py
parent9cfc3300e11cff63d3532d43d95bd17cba5b9cb4 (diff)
parent5808051426cab03a0dc117c73b941b0afb05a87d (diff)
downloadenigma2-bc8b453f3e2a5a142faa23efdb777165b33e788d.tar.gz
enigma2-bc8b453f3e2a5a142faa23efdb777165b33e788d.zip
Merge branch 'master' of git.opendreambox.org:/git/enigma2
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