1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

Merge pull request #62 from bjackman/check-governor-supported

cpufreq: Improve error when setting all CPUs to unsupported governor
This commit is contained in:
setrofim 2016-10-11 14:36:12 +01:00 committed by GitHub
commit 25818b035e

View File

@ -375,9 +375,18 @@ class CpufreqModule(Module):
"""
Set the specified governor for all the (online) CPUs
"""
return self.target._execute_util(
try:
return self.target._execute_util(
'cpufreq_set_all_governors {}'.format(governor),
as_root=True)
except TargetError as e:
if "echo: I/O error" in str(e):
cpus_unsupported = [c for c in self.target.list_online_cpus()
if governor not in self.list_governors(c)]
raise TargetError("Governor {} unsupported for CPUs {}".format(
governor, cpus_unsupported))
else:
raise
def get_all_governors(self):
"""