aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPA4WDH2023-05-21 16:33:56 +0200
committerPA4WDH2023-05-21 16:33:56 +0200
commitdcf3e0e64a16b7a09c8396e4e28fdebe3e7e68f4 (patch)
treeb6eb567e329910999c16ae5df90520ef9d670351
parentAdd argument parsing and validation (diff)
downloadcputemp2maxfreq-dcf3e0e64a16b7a09c8396e4e28fdebe3e7e68f4.tar.gz
cputemp2maxfreq-dcf3e0e64a16b7a09c8396e4e28fdebe3e7e68f4.tar.bz2
cputemp2maxfreq-dcf3e0e64a16b7a09c8396e4e28fdebe3e7e68f4.zip
Add keep feature for governor
-rw-r--r--cputemp2maxfreq.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/cputemp2maxfreq.c b/cputemp2maxfreq.c
index b023b79..aabb99f 100644
--- a/cputemp2maxfreq.c
+++ b/cputemp2maxfreq.c
@@ -56,7 +56,6 @@ int main(int argc,char **argv)
{
printf("Invalid poll interval, range is %d-%d\n",VALID_INTERVAL_MIN,VALID_INTERVAL_MAX);
exit(1);
-
}
// Get and validate CPU data
@@ -79,7 +78,7 @@ int main(int argc,char **argv)
exit(1);
}
-// Modify fallback frequency is needed
+// Modify fallback frequency if needed
if (config.fallback_freq<cpudata.min_freq)
{
printf("Fallback frequency is lower than CPU's minimum frequency, setting to %ld.\n",cpudata.min_freq);
@@ -92,12 +91,15 @@ int main(int argc,char **argv)
}
// Set the governor
- if (cpufreq_set_str("scaling_governor",config.governor,0)<0)
+ if (strcmp(config.governor,"keep")!=0)
{
- printf("Failed to set governor, error %d (%s).\n",errno,strerror(errno));
+ if (cpufreq_set_str("scaling_governor",config.governor,0)<0)
+ {
+ printf("Failed to set governor, error %d (%s).\n",errno,strerror(errno));
// We failed to set the governor, call the failsafe
- failsafe(1);
+ failsafe(1);
+ }
}
// Set signal handlers