diff options
author | PA4WDH | 2023-05-21 16:33:56 +0200 |
---|---|---|
committer | PA4WDH | 2023-05-21 16:33:56 +0200 |
commit | dcf3e0e64a16b7a09c8396e4e28fdebe3e7e68f4 (patch) | |
tree | b6eb567e329910999c16ae5df90520ef9d670351 /cputemp2maxfreq.c | |
parent | Add argument parsing and validation (diff) | |
download | cputemp2maxfreq-dcf3e0e64a16b7a09c8396e4e28fdebe3e7e68f4.tar.gz cputemp2maxfreq-dcf3e0e64a16b7a09c8396e4e28fdebe3e7e68f4.tar.bz2 cputemp2maxfreq-dcf3e0e64a16b7a09c8396e4e28fdebe3e7e68f4.zip |
Add keep feature for governor
Diffstat (limited to 'cputemp2maxfreq.c')
-rw-r--r-- | cputemp2maxfreq.c | 12 |
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 |