mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
Merge pull request #107 from bjackman/cpufreq-expose-tunable-error
cpufreq: Expose error when writing invalid governor tunable
This commit is contained in:
commit
f4d3c60137
@ -152,10 +152,14 @@ class CpufreqModule(Module):
|
|||||||
valid_tunables = self.list_governor_tunables(cpu)
|
valid_tunables = self.list_governor_tunables(cpu)
|
||||||
for tunable, value in kwargs.iteritems():
|
for tunable, value in kwargs.iteritems():
|
||||||
if tunable in valid_tunables:
|
if tunable in valid_tunables:
|
||||||
try:
|
|
||||||
path = '/sys/devices/system/cpu/{}/cpufreq/{}/{}'.format(cpu, governor, tunable)
|
path = '/sys/devices/system/cpu/{}/cpufreq/{}/{}'.format(cpu, governor, tunable)
|
||||||
|
try:
|
||||||
self.target.write_value(path, value)
|
self.target.write_value(path, value)
|
||||||
except TargetError: # May be an older kernel
|
except TargetError:
|
||||||
|
if self.target.file_exists(path):
|
||||||
|
# File exists but we did something wrong
|
||||||
|
raise
|
||||||
|
# Expected file doesn't exist, try older sysfs layout.
|
||||||
path = '/sys/devices/system/cpu/cpufreq/{}/{}'.format(governor, tunable)
|
path = '/sys/devices/system/cpu/cpufreq/{}/{}'.format(governor, tunable)
|
||||||
self.target.write_value(path, value)
|
self.target.write_value(path, value)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user