summaryrefslogtreecommitdiff
path: root/src/print_cpu_temperature.c
diff options
context:
space:
mode:
authorJasper Lievisse Adriaanse <jasper@openbsd.org>2012-10-10 09:53:34 +0200
committerMichael Stapelberg <michael@stapelberg.de>2012-10-16 10:48:44 +0200
commit1c2517a3998385dbfca0559aca3ba7e72b5c216c (patch)
treeb2340b4ee6c501b5f78de5a5c1551ff553ac5903 /src/print_cpu_temperature.c
parented03d2450ceae3cc7952b65d8349373bbb45a487 (diff)
i3status - Default to acpitz(4) instead of cpu(4) for OpenBSD temperature readings
The acpitz(4) values are eventually used by the kernel to determine if the machine is getting too hot.
Diffstat (limited to 'src/print_cpu_temperature.c')
-rw-r--r--src/print_cpu_temperature.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/print_cpu_temperature.c b/src/print_cpu_temperature.c
index 8e7d7f9..b1d1221 100644
--- a/src/print_cpu_temperature.c
+++ b/src/print_cpu_temperature.c
@@ -88,18 +88,19 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const
goto error;
}
/*
- * 'path' is actually the node within the full path (eg, cpu0).
+ * 'path' is actually the node within the full path (currently always acpitz0).
* XXX: Extend the API to allow a string instead of just an int for path, this would
- * allow us to have a path of 'acpitz0' for example.
+ * allow us to build an arbitrary path.
*/
if (strncmp(sensordev.xname, path, strlen(path)) == 0) {
mib[3] = SENSOR_TEMP;
for (numt = 0; numt < sensordev.maxnumt[SENSOR_TEMP]; numt++) {
mib[4] = numt;
if (sysctl(mib, 5, &sensor, &slen, NULL, 0) == -1) {
- if (errno != ENOENT)
+ if (errno != ENOENT) {
warn("sysctl");
- continue;
+ continue;
+ }
}
outwalk += sprintf(outwalk, "%.2f", (sensor.value - 273150000) / 1000000.0 );
}