From 88f8c9e9ac7c7fc703507fe89bb793976e90a7a8 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Tue, 30 Jul 2019 09:38:54 +0100 Subject: [PATCH] module/cpuidle: Add fallback for reading governor As per #407 if the kernel is compiled with the ability to switch cpuidle governors via sysfs `current_governor_ro` is replaced with `current_governor` so check if the intial path exists before reading. --- devlib/module/cpuidle.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/devlib/module/cpuidle.py b/devlib/module/cpuidle.py index ba1e3e6..a837238 100644 --- a/devlib/module/cpuidle.py +++ b/devlib/module/cpuidle.py @@ -173,4 +173,7 @@ class Cpuidle(Module): return self.target.read_value(self.target.path.join(self.root_path, 'current_driver')) def get_governor(self): - return self.target.read_value(self.target.path.join(self.root_path, 'current_governor_ro')) + path = self.target.path.join(self.root_path, 'current_governor_ro') + if not self.target.path.exist(path): + path = self.target.path.join(self.root_path, 'current_governor') + return self.target.read_value(path)