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.
This commit is contained in:
parent
7dd5077692
commit
8a5e2704e0
|
@ -38,9 +38,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#if defined(__linux__)
|
#if !defined(__linux__)
|
||||||
# define BORING_USER 1
|
|
||||||
#else
|
|
||||||
# include <sys/sysctl.h>
|
# include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
@ -682,16 +680,17 @@ _sensors_thermal_get(Sys_Info *sysinfo)
|
||||||
sensor->value = (snsr.value - 273150000) / 1000000.0; // (uK -> C)
|
sensor->value = (snsr.value - 273150000) / 1000000.0; // (uK -> C)
|
||||||
}
|
}
|
||||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
unsigned int value;
|
sensor_t *sensor;
|
||||||
|
int value;
|
||||||
size_t len = sizeof(value);
|
size_t len = sizeof(value);
|
||||||
if ((sysctlbyname
|
|
||||||
("hw.acpi.thermal.tz0.temperature", &value, &len, NULL,
|
if ((sysctlbyname("hw.acpi.thermal.tz0.temperature", &value, &len, NULL, 0)) != -1)
|
||||||
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__)
|
#elif defined(__linux__)
|
||||||
sensor_t *sensor;
|
sensor_t *sensor;
|
||||||
struct dirent *dh;
|
struct dirent *dh;
|
||||||
|
|
Loading…
Reference in New Issue