aboutsummaryrefslogtreecommitdiff
path: root/modules/devices/sensors.c
diff options
context:
space:
mode:
authorLeandro Pereira <leandro@hardinfo.org>2017-07-04 13:47:47 -0700
committerLeandro Pereira <leandro@hardinfo.org>2017-07-04 13:47:47 -0700
commit60131f4f0beb43ddb501a0ff114030c9c5f28b7d (patch)
tree21e3c1e83237c46b65f309c0265e9fb15ea80669 /modules/devices/sensors.c
parent9feaca9d2e36ef39fadad49a640a024b1adafe15 (diff)
Use load graph (used in memory view) to graph sensor data
Writing this I realized why I stopped working on HardInfo. While there are some good ideas in the architecture, it's API is beyond salvation. It's buggy, quirky, and not intuitive at all.
Diffstat (limited to 'modules/devices/sensors.c')
-rw-r--r--modules/devices/sensors.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/modules/devices/sensors.c b/modules/devices/sensors.c
index 8c33feb3..c9d78ff7 100644
--- a/modules/devices/sensors.c
+++ b/modules/devices/sensors.c
@@ -131,10 +131,15 @@ static void add_sensor(const char *type,
const char *driver,
double value,
const char *unit) {
- static int count = 0;
+ char key[64];
- sensors = h_strdup_cprintf("%s#%d=%s|%s|%.2f%s\n",
- sensors, type, count++, driver, sensor, value, unit);
+ sensors = h_strdup_cprintf("%s/%s=%.2f%s|%s\n", sensors,
+ driver, sensor, value, unit, type);
+
+ snprintf(key, sizeof(key), "%s/%s", driver, sensor);
+ moreinfo_add_with_prefix("DEV", key, g_strdup_printf("%.2f%s", value, unit));
+
+ lginterval = h_strdup_cprintf("UpdateInterval$%s=1000\n", lginterval, key);
}
static gchar *get_sensor_label(gchar *sensor) {
@@ -348,7 +353,7 @@ static void read_sensors_sys_thermal(void) {
add_sensor("Temperature",
entry,
- "thermal_zone",
+ "thermal",
temperature / 1000.0,
"\302\260C");
@@ -423,15 +428,16 @@ static void read_sensors_hddtemp(void) {
void scan_sensors_do(void) {
g_free(sensors);
-
sensors = g_strdup("");
+ g_free(lginterval);
+ lginterval = g_strdup("");
+
read_sensors_hwmon();
read_sensors_acpi();
read_sensors_sys_thermal();
read_sensors_omnibook();
read_sensors_hddtemp();
-
/* FIXME: Add support for ibm acpi and more sensors */
}