- change the default (and since the API is still limiting us here, only)

device from which we read temperature values from, from cpu(4) to acpitz(4).
This commit is contained in:
jasper 2012-10-09 13:19:48 +00:00
parent 40b67ea21a
commit b49e4e3a8f
4 changed files with 73 additions and 9 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.21 2012/10/09 11:32:45 jasper Exp $
# $OpenBSD: Makefile,v 1.22 2012/10/09 13:19:48 jasper Exp $
ONLY_FOR_ARCHS= ${APM_ARCHS}
COMMENT= generate a statusbar for use with i3/xmobar/dzen2
DISTNAME= i3status-2.6
REVISION= 12
REVISION= 13
CATEGORIES= x11 sysutils
HOMEPAGE= http://i3wm.org/i3status/

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-i3status_conf,v 1.7 2012/10/09 09:32:26 jasper Exp $
$OpenBSD: patch-i3status_conf,v 1.8 2012/10/09 13:19:48 jasper Exp $
Adjust config file to be reasonably useful on OpenBSD out of the box.
--- i3status.conf.orig Wed Oct 3 13:44:44 2012
+++ i3status.conf Tue Oct 9 13:26:23 2012
+++ i3status.conf Tue Oct 9 17:12:12 2012
@@ -1,41 +1,37 @@
general {
+ output_format = "i3bar"
@ -22,16 +22,15 @@ Adjust config file to be reasonably useful on OpenBSD out of the box.
order += "battery 0"
order += "load"
order += "time"
+#order += "cpu_temperature cpu0"
+order += "cpu_temperature acpitz0" # device is not configureable...
+order += "volume master"
-wireless wlan0 {
- format_up = "W: (%quality at %essid) %ip"
- format_down = "W: down"
-}
+#cpu_temperature cpu0 {
+# format = "T: %degrees C"
+#}
+cpu_temperature acpitz0 {
+ format = "TZ: %degrees C"
}
-ethernet eth0 {
- # if you use %speed, i3status requires root privileges

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-include_i3status_h,v 1.5 2012/10/09 13:19:48 jasper Exp $
Default to acpitz(4) for temperature readings, instead of cpu(4).
The acpitz(4) values are eventually used by the kernel to determine if the machine
is getting too hot.
--- include/i3status.h.orig Tue Oct 9 17:10:15 2012
+++ include/i3status.h Tue Oct 9 17:10:22 2012
@@ -31,9 +31,11 @@ enum { O_DZEN2, O_XMOBAR, O_I3BAR, O_NONE } output_for
* Due to the fact there are various ways to obtain a temperature reading, THERMAL_ZONE will need
* to be adjustable enough for those situations. As it can either be hw.sensors.cpu%d.temp0, or
* hw.sensors.acpitz%d.temp0 or even something different entirely within hw.sensors.%s.temp0.
- * XXX: For now just check cpu%d.temp0. Adjust this later.
+ * XXX:
+ * Due to the fact the i3status API only allows to set the THERMAL_ZONE parameter to an integer,
+ * we can't make this fully configureable (yet?).
*/
-#define THERMAL_ZONE "cpu%d"
+#define THERMAL_ZONE "acpitz%d"
#endif

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-src_print_cpu_temperature_c,v 1.3 2012/10/09 13:19:48 jasper Exp $
Default to acpitz(4) for temperature readings, instead of cpu(4).
The acpitz(4) values are eventually used by the kernel to determine if the machine
is getting too hot.
--- src/print_cpu_temperature.c.orig Tue Oct 9 17:09:57 2012
+++ src/print_cpu_temperature.c Tue Oct 9 17:10:07 2012
@@ -88,18 +88,19 @@ void print_cpu_temperature_info(yajl_gen json_gen, cha
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 );
}
@@ -109,9 +110,9 @@ void print_cpu_temperature_info(yajl_gen json_gen, cha
walk += strlen("degrees");
}
}
+error:
OUTPUT_FULL_TEXT(buffer);
return;
-error:
#endif
OUTPUT_FULL_TEXT("cant read temp");
(void)fputs("i3status: Cannot read temperature. Verify that you have a thermal zone in /sys/class/thermal or disable the cpu_temperature module in your i3status config.\n", stderr);