From 7006a07c6ba3607ae3f8bdca069c950d7cfcf0c3 Mon Sep 17 00:00:00 2001 From: PA4WDH Date: Sun, 25 Aug 2024 15:51:32 +0200 Subject: Small bugfix in sensor autodetection when -P is used --- cputemp2maxfreq.c | 12 ++++++++---- 1 file 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); -- cgit v1.2.3