diff options
author | PA4WDH | 2024-08-25 15:51:32 +0200 |
---|---|---|
committer | PA4WDH | 2024-08-25 15:51:32 +0200 |
commit | 7006a07c6ba3607ae3f8bdca069c950d7cfcf0c3 (patch) | |
tree | 84d4bc9fb8f97b3b63f72bdb6c51aaad8e6d3f46 | |
parent | Add manpage (diff) | |
download | cputemp2maxfreq-7006a07c6ba3607ae3f8bdca069c950d7cfcf0c3.tar.gz cputemp2maxfreq-7006a07c6ba3607ae3f8bdca069c950d7cfcf0c3.tar.bz2 cputemp2maxfreq-7006a07c6ba3607ae3f8bdca069c950d7cfcf0c3.zip |
Small bugfix in sensor autodetection when -P is used
-rw-r--r-- | cputemp2maxfreq.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cputemp2maxfreq.c b/cputemp2maxfreq.c index cd2da9f..91f1941 100644 --- a/cputemp2maxfreq.c +++ b/cputemp2maxfreq.c @@ -140,17 +140,21 @@ int main(int argc,char **argv) if (strcmp(config.temp_input,"auto")==0) { config.logger("Starting temperature sensor autodetection"); + sensor.valid=0; if (config.cpu>=0) { sprintf(sensor_string,"Package id %d",config.cpu); DEBUG1_MAIN("Searching for sensor \"%s\" because of -P option\n",sensor_string); cputemp_find_sensor(sensor_string,&sensor); } - for(count=0;autodetect_sensors[count]!=NULL;count++) + if (sensor.valid==0) { - DEBUG1_MAIN("Searching for sensor \"%s\"\n",autodetect_sensors[count]); - cputemp_find_sensor(autodetect_sensors[count],&sensor); - if (sensor.valid==1) break; + for(count=0;autodetect_sensors[count]!=NULL;count++) + { + DEBUG1_MAIN("Searching for sensor \"%s\"\n",autodetect_sensors[count]); + cputemp_find_sensor(autodetect_sensors[count],&sensor); + if (sensor.valid==1) break; + } } } else { DEBUG1_MAIN("Starting temperature sensor detection with name \"%s\"\n",config.temp_input); |