Commit 42161483 authored by Todd Brandt's avatar Todd Brandt Committed by Rafael J. Wysocki

pm-graph: make setVal unbuffered again for python2 and python3

sleepgraph:
 - kprobe_events won't set correctly if the data is buffered
 - force sysvals.setVal to be unbuffered and use binary mode
 - tested in both python2 and python3

Link: https://bugzilla.kernel.org/show_bug.cgi?id=204773Signed-off-by: default avatarTodd Brandt <todd.e.brandt@linux.intel.com>
[ rjw: Subject ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 1446794a
...@@ -667,19 +667,19 @@ class SystemValues: ...@@ -667,19 +667,19 @@ class SystemValues:
if linesack < linesout: if linesack < linesout:
return False return False
return True return True
def setVal(self, val, file, mode='w'): def setVal(self, val, file):
if not os.path.exists(file): if not os.path.exists(file):
return False return False
try: try:
fp = open(file, mode) fp = open(file, 'wb', 0)
fp.write(val) fp.write(val.encode())
fp.flush() fp.flush()
fp.close() fp.close()
except: except:
return False return False
return True return True
def fsetVal(self, val, path, mode='w'): def fsetVal(self, val, path):
return self.setVal(val, self.tpath+path, mode) return self.setVal(val, self.tpath+path)
def getVal(self, file): def getVal(self, file):
res = '' res = ''
if not os.path.exists(file): if not os.path.exists(file):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment