netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=8a5e2704e019c4f29eb069d2741771b48bd008fd

commit 8a5e2704e019c4f29eb069d2741771b48bd008fd
Author: Alastair Poole <[email protected]>
Date:   Tue Jun 16 17:29:51 2020 +0100

    freebsd: thermal here sucks.
    
    There are modules for more but it's too much. They should use a
    decent API and not put things all over the place/name space.
---
 src/bin/system/machine.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/bin/system/machine.c b/src/bin/system/machine.c
index 214d2b5..7ab10d1 100644
--- a/src/bin/system/machine.c
+++ b/src/bin/system/machine.c
@@ -38,9 +38,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/param.h>
-#if defined(__linux__)
-# define BORING_USER 1
-#else
+#if !defined(__linux__)
 # include <sys/sysctl.h>
 #endif
 #include <sys/ioctl.h>
@@ -682,16 +680,17 @@ _sensors_thermal_get(Sys_Info *sysinfo)
         sensor->value = (snsr.value - 273150000) / 1000000.0; // (uK -> C)
      }
 #elif defined(__FreeBSD__) || defined(__DragonFly__)
-   unsigned int value;
+   sensor_t *sensor;
+   int value;
    size_t len = sizeof(value);
-   if ((sysctlbyname
-          ("hw.acpi.thermal.tz0.temperature", &value, &len, NULL,
-          0)) != -1)
+
+   if ((sysctlbyname("hw.acpi.thermal.tz0.temperature", &value, &len, NULL, 
0)) != -1)
      {
-        *temperature = (value -  2732) / 10;
+        sensors = realloc(sensors, 1 + sysinfo->snsr_count * sizeof(sensor_t 
*));
+        sensors[sysinfo->snsr_count++] = sensor = calloc(1, sizeof(sensor_t));
+        sensor->name = strdup("hw.acpi.thermal.tz0");
+        sensor->value = (float) (value -  2732) / 10;
      }
-   else
-     *temperature = INVALID_TEMP;
 #elif defined(__linux__)
    sensor_t *sensor;
    struct dirent *dh;

-- 


Reply via email to