cpu: coretemp out by one !

This commit is contained in:
Alastair Poole 2020-10-11 12:06:41 +01:00
parent 856b3acd13
commit a3538e9b43
1 changed files with 6 additions and 2 deletions

View File

@ -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__)