From a3538e9b434d8c8c7ad32692f62ca0b6dc3d630a Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Sun, 11 Oct 2020 12:06:41 +0100 Subject: [PATCH] cpu: coretemp out by one ! --- src/bin/system/machine/cpu.bogox | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bin/system/machine/cpu.bogox b/src/bin/system/machine/cpu.bogox index e9c1f4e..b4d2ca8 100644 --- a/src/bin/system/machine/cpu.bogox +++ b/src/bin/system/machine/cpu.bogox @@ -293,6 +293,7 @@ _cpu_n_temperature_read(int n) { int temp = -1; #if defined(__linux__) + char *b = file_contents(_core_temps[n]); if (b) { @@ -372,8 +373,11 @@ system_cpu_n_temperature_get(int n) if (type == THERMAL_INTEL_CORETEMP) { cpu_count = system_cpu_count_get(); - i = 1 + ((cpu_count + n) / 2) - (cpu_count / 2); - snprintf(_core_temps[n], sizeof(_core_temps[n]), "%s/temp%d_input", _hwmon_path, i); + for (int j = 0; j < cpu_count; j++) + { + i = 2 + ((cpu_count + j) / 2) - (cpu_count / 2); + snprintf(_core_temps[j], sizeof(_core_temps[j]), "%s/temp%d_input", _hwmon_path, i); + } } return _cpu_n_temperature_read(n); #elif defined(__FreeBSD__) || defined(__DragonFly__)