git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "bug #258"
[enigma2.git]
/
lib
/
python
/
Components
/
Harddisk.py
diff --git
a/lib/python/Components/Harddisk.py
b/lib/python/Components/Harddisk.py
index 637c8898a71927a6dbf80ef96ac6e1a1df6f9739..03f574f3dbb207e60e6f1c6a7e5ad6796461c0bc 100755
(executable)
--- a/
lib/python/Components/Harddisk.py
+++ b/
lib/python/Components/Harddisk.py
@@
-6,11
+6,7
@@
import time
from Components.Console import Console
def readFile(filename):
from Components.Console import Console
def readFile(filename):
- try:
- file = open(filename)
- except IOError:
- return ""
-
+ file = open(filename)
data = file.read().strip()
file.close()
return data
data = file.read().strip()
file.close()
return data
@@
-294,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):
# 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)
(nr_read, _, _, _, nr_write) = l.split()[:5]
return int(nr_read), int(nr_write)
@@
-323,7
+322,7
@@
class Harddisk:
l = sum(stats)
print "sum", l, "prev_sum", self.last_stat
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
print "hdd was accessed since previous check!"
self.last_stat = l
self.last_access = t