From 3185eb2425a56d0cb9dc717260bbc0336446c02c Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Tue, 22 Dec 2020 18:00:55 +0000 Subject: [PATCH] sensors: typo and dragonzz --- src/bin/system/machine/sensors.bogox | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/bin/system/machine/sensors.bogox b/src/bin/system/machine/sensors.bogox index 821a613..2a7b88f 100644 --- a/src/bin/system/machine/sensors.bogox +++ b/src/bin/system/machine/sensors.bogox @@ -41,11 +41,11 @@ system_sensor_thermal_get(sensor_t *sensor) char *d = file_contents(sensor->path); if (d) { - double val = atof(d); - if (val); - sensor->value = val /= 1000; - free(d); - return 1; + double val = atof(d); + if (val) + sensor->value = val /= 1000; + free(d); + return 1; } return 0; #elif defined(__OpenBSD__) @@ -57,6 +57,14 @@ system_sensor_thermal_get(sensor_t *sensor) sensor->value = (snsr.value - 273150000) / 1000000.0; return 1; +#elif defined(__FreeBSD__) || defined(__DragonFly__) + int value; + size_t len = sizeof(value); + if ((sysctlbyname(sensor->name, &value, &len, NULL, 0)) != -1) + { + sensor->value = (float) (value - 2732) / 10; + return 1; + } #endif return 0; }