- update to i3status-2.7
* all functional patches have been committed upstream. tested by and ok rpe@
This commit is contained in:
parent
8a94def5c4
commit
cd9591ea24
@ -1,11 +1,10 @@
|
||||
# $OpenBSD: Makefile,v 1.27 2013/03/04 11:34:51 jasper Exp $
|
||||
# $OpenBSD: Makefile,v 1.28 2013/03/08 10:23:13 jasper Exp $
|
||||
|
||||
ONLY_FOR_ARCHS= ${APM_ARCHS}
|
||||
|
||||
COMMENT= generate a statusbar for use with i3/xmobar/dzen2
|
||||
|
||||
DISTNAME= i3status-2.6
|
||||
REVISION= 17
|
||||
DISTNAME= i3status-2.7
|
||||
CATEGORIES= x11 sysutils
|
||||
|
||||
HOMEPAGE= http://i3wm.org/i3status/
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (i3status-2.6.tar.bz2) = 5+cQzCcYh7zSJ1cmnhsApWGPtTq9s0VRQBFrPTh5e84=
|
||||
SIZE (i3status-2.6.tar.bz2) = 34896
|
||||
SHA256 (i3status-2.7.tar.bz2) = Bz9OXeO8WvwfI8UupS4qpLkMqKAS8ouixfrDwzR0pjI=
|
||||
SIZE (i3status-2.7.tar.bz2) = 37594
|
||||
|
@ -1,13 +1,13 @@
|
||||
$OpenBSD: patch-Makefile,v 1.3 2012/10/04 06:15:38 jasper Exp $
|
||||
$OpenBSD: patch-Makefile,v 1.4 2013/03/08 10:23:13 jasper Exp $
|
||||
|
||||
- Don't do a silent build.
|
||||
|
||||
--- Makefile.orig Wed Oct 3 13:44:44 2012
|
||||
+++ Makefile Wed Oct 3 15:28:57 2012
|
||||
@@ -49,17 +49,17 @@ OBJS:=$(wildcard src/*.c *.c)
|
||||
--- Makefile.orig Wed Feb 27 23:16:03 2013
|
||||
+++ Makefile Wed Feb 27 23:16:21 2013
|
||||
@@ -56,17 +56,17 @@ OBJS:=$(wildcard src/*.c *.c)
|
||||
OBJS:=$(OBJS:.c=.o)
|
||||
|
||||
src/%.o: src/%.c
|
||||
src/%.o: src/%.c include/i3status.h
|
||||
- @$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||
@echo " CC $<"
|
||||
|
@ -1,26 +0,0 @@
|
||||
$OpenBSD: patch-i3status_c,v 1.2 2012/10/16 10:40:21 jasper Exp $
|
||||
|
||||
From ae4873bac793245e7dea4719c8e0d1c7bc990d5f Mon Sep 17 00:00:00 2001
|
||||
From: Jasper Lievisse Adriaanse <jasper@openbsd.org>
|
||||
Date: Wed, 10 Oct 2012 07:57:32 +0000
|
||||
Subject: i3status - More temperature related fixes for OpenBSD, and a general feature
|
||||
|
||||
--- i3status.c.orig Tue Oct 9 20:35:06 2012
|
||||
+++ i3status.c Tue Oct 9 20:35:15 2012
|
||||
@@ -243,6 +243,7 @@ int main(int argc, char *argv[]) {
|
||||
cfg_opt_t temp_opts[] = {
|
||||
CFG_STR("format", "%degrees C", CFGF_NONE),
|
||||
CFG_STR("path", NULL, CFGF_NONE),
|
||||
+ CFG_INT("max_threshold", 75, CFGF_NONE),
|
||||
CFG_END()
|
||||
};
|
||||
|
||||
@@ -460,7 +461,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
CASE_SEC_TITLE("cpu_temperature") {
|
||||
SEC_OPEN_MAP("cpu_temperature");
|
||||
- print_cpu_temperature_info(json_gen, buffer, atoi(title), cfg_getstr(sec, "path"), cfg_getstr(sec, "format"));
|
||||
+ print_cpu_temperature_info(json_gen, buffer, atoi(title), cfg_getstr(sec, "path"), cfg_getstr(sec, "format"), cfg_getint(sec, "max_threshold"));
|
||||
SEC_CLOSE_MAP;
|
||||
}
|
||||
|
@ -1,12 +1,20 @@
|
||||
$OpenBSD: patch-i3status_conf,v 1.10 2012/10/12 07:57:26 dcoppa Exp $
|
||||
$OpenBSD: patch-i3status_conf,v 1.11 2013/03/08 10:23:13 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 Thu Oct 11 19:31:41 2012
|
||||
@@ -1,41 +1,43 @@
|
||||
--- i3status.conf.orig Wed Feb 27 10:56:44 2013
|
||||
+++ i3status.conf Wed Feb 27 23:24:44 2013
|
||||
@@ -1,49 +1,46 @@
|
||||
# i3status configuration file.
|
||||
# see "man i3status" for documentation.
|
||||
|
||||
-# It is important that this file is edited as UTF-8.
|
||||
-# The following line should contain a sharp s:
|
||||
-# ß
|
||||
-# If the above line is not correctly displayed, fix your editor first!
|
||||
-
|
||||
general {
|
||||
+ output_format = "i3bar"
|
||||
+ output_format = "i3bar"
|
||||
colors = true
|
||||
interval = 5
|
||||
}
|
||||
@ -21,7 +29,7 @@ Adjust config file to be reasonably useful on OpenBSD out of the box.
|
||||
+order += "ethernet em0"
|
||||
order += "battery 0"
|
||||
order += "load"
|
||||
order += "time"
|
||||
order += "tztime local"
|
||||
+order += "cpu_temperature cpu0"
|
||||
+order += "cpu_temperature acpitz0"
|
||||
+order += "volume master"
|
||||
@ -29,8 +37,8 @@ Adjust config file to be reasonably useful on OpenBSD out of the box.
|
||||
-wireless wlan0 {
|
||||
- format_up = "W: (%quality at %essid) %ip"
|
||||
+cpu_temperature cpu0 {
|
||||
+ format = "C: %degrees C"
|
||||
+ path = "cpu0"
|
||||
+ format = "C: %degrees C"
|
||||
+ path = "cpu0"
|
||||
+}
|
||||
+
|
||||
+cpu_temperature acpitz0 {
|
||||
@ -51,7 +59,7 @@ Adjust config file to be reasonably useful on OpenBSD out of the box.
|
||||
|
||||
battery 0 {
|
||||
- format = "%status %percentage %remaining"
|
||||
+ format = "%status %percentage \% %remaining min."
|
||||
+ format = "%status %percentage \% %remaining"
|
||||
}
|
||||
|
||||
-run_watch DHCP {
|
||||
@ -62,13 +70,13 @@ Adjust config file to be reasonably useful on OpenBSD out of the box.
|
||||
- pidfile = "/var/run/vpnc/pid"
|
||||
-}
|
||||
-
|
||||
time {
|
||||
tztime local {
|
||||
format = "%Y-%m-%d %H:%M:%S"
|
||||
}
|
||||
@@ -46,4 +48,8 @@ load {
|
||||
@@ -54,4 +51,8 @@ load {
|
||||
|
||||
disk "/" {
|
||||
format = "%free (or: %percentage_used used, %percentage_used_of_avail used of avail, %percentage_free free, %percentage_avail avail)"
|
||||
format = "%free"
|
||||
+}
|
||||
+
|
||||
+volume master {
|
||||
|
@ -1,40 +0,0 @@
|
||||
$OpenBSD: patch-include_i3status_h,v 1.8 2012/10/16 10:40:21 jasper Exp $
|
||||
|
||||
From ae4873bac793245e7dea4719c8e0d1c7bc990d5f Mon Sep 17 00:00:00 2001
|
||||
From: Jasper Lievisse Adriaanse <jasper@openbsd.org>
|
||||
Date: Wed, 10 Oct 2012 07:57:32 +0000
|
||||
Subject: i3status - More temperature related fixes for OpenBSD, and a general feature
|
||||
|
||||
From 1c2517a3998385dbfca0559aca3ba7e72b5c216c Mon Sep 17 00:00:00 2001
|
||||
From: Jasper Lievisse Adriaanse <jasper@openbsd.org>
|
||||
Date: Wed, 10 Oct 2012 07:53:34 +0000
|
||||
Subject: i3status - Default to acpitz(4) instead of cpu(4) for OpenBSD temperature readings
|
||||
|
||||
--- include/i3status.h.orig Wed Oct 3 13:44:44 2012
|
||||
+++ include/i3status.h Tue Oct 9 20:36:02 2012
|
||||
@@ -27,14 +27,8 @@ enum { O_DZEN2, O_XMOBAR, O_I3BAR, O_NONE } output_for
|
||||
#define BATT_STATE "hw.acpi.battery.state"
|
||||
|
||||
#elif defined(__OpenBSD__)
|
||||
-/*
|
||||
- * 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.
|
||||
- */
|
||||
-#define THERMAL_ZONE "cpu%d"
|
||||
-
|
||||
+/* Default to acpitz(4) if no path is set. */
|
||||
+#define THERMAL_ZONE "acpitz%d"
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD_kernel__) && defined(__GLIBC__)
|
||||
@@ -143,7 +137,7 @@ void print_ddate(yajl_gen json_gen, char *buffer, cons
|
||||
const char *get_ip_addr();
|
||||
void print_wireless_info(yajl_gen json_gen, char *buffer, const char *interface, const char *format_up, const char *format_down);
|
||||
void print_run_watch(yajl_gen json_gen, char *buffer, const char *title, const char *pidfile, const char *format);
|
||||
-void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const char *path, const char *format);
|
||||
+void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const char *path, const char *format, int);
|
||||
void print_cpu_usage(yajl_gen json_gen, char *buffer, const char *format);
|
||||
void print_eth_info(yajl_gen json_gen, char *buffer, const char *interface, const char *format_up, const char *format_down);
|
||||
void print_load(yajl_gen json_gen, char *buffer, const char *format);
|
@ -1,37 +0,0 @@
|
||||
$OpenBSD: patch-man_i3status_man,v 1.5 2012/10/25 14:21:54 jasper Exp $
|
||||
|
||||
From ae4873bac793245e7dea4719c8e0d1c7bc990d5f Mon Sep 17 00:00:00 2001
|
||||
From: Jasper Lievisse Adriaanse <jasper@openbsd.org>
|
||||
Date: Wed, 10 Oct 2012 07:57:32 +0000
|
||||
Subject: i3status - More temperature related fixes for OpenBSD, and a general feature
|
||||
|
||||
--- man/i3status.man.orig Wed Oct 3 13:44:44 2012
|
||||
+++ man/i3status.man Thu Oct 25 11:44:16 2012
|
||||
@@ -188,8 +188,8 @@ connected.
|
||||
=== Ethernet
|
||||
|
||||
Gets the IP address and (if possible) the link speed of the given ethernet
|
||||
-interface. Getting the link speed requires the cap_net_admin capability. Set
|
||||
-it using +setcap cap_net_admin=ep $(which i3status)+.
|
||||
+interface. Getting the link speed requires the cap_net_admin
|
||||
+capability on Linux. Set it using +setcap cap_net_admin=ep $(which i3status)+.
|
||||
|
||||
*Example order*: +ethernet eth0+
|
||||
|
||||
@@ -224,11 +224,15 @@ colored red. The low_threshold type can be of threshol
|
||||
|
||||
=== CPU-Temperature
|
||||
|
||||
-Gets the temperature of the given thermal zone.
|
||||
+Gets the temperature of the given thermal zone. It is possible to
|
||||
+define a max_threshold that will color the temperature red in case the
|
||||
+specified thermal zone is getting too hot. Defaults to 75 degrees C.
|
||||
|
||||
*Example order*: +cpu_temperature 0+
|
||||
|
||||
*Example format*: +T: %degrees °C+
|
||||
+
|
||||
+*Example max_threshold*: +42+
|
||||
|
||||
=== CPU Usage
|
||||
|
@ -1,72 +0,0 @@
|
||||
$OpenBSD: patch-src_print_battery_info_c,v 1.8 2012/10/10 07:20:16 jasper Exp $
|
||||
|
||||
From 8da0452d2c51826fd871520f7a8ba7a43a59401c Mon Sep 17 00:00:00 2001
|
||||
From: Jasper Lievisse Adriaanse <jasper@openbsd.org>
|
||||
Date: Mon, 08 Oct 2012 11:30:38 +0000
|
||||
Subject: Various fixes for the OpenBSD section of the battery backend.
|
||||
|
||||
- fix the battery status printing in %status.
|
||||
- fix remaining time when we're charging.
|
||||
- use colors to indicate battery status.
|
||||
- small cleanups.
|
||||
|
||||
--- src/print_battery_info.c.orig Wed Oct 3 13:44:44 2012
|
||||
+++ src/print_battery_info.c Mon Oct 8 15:23:17 2012
|
||||
@@ -228,7 +228,7 @@ void print_battery_info(yajl_gen json_gen, char *buffe
|
||||
* probing acpi(4) devices.
|
||||
*/
|
||||
struct apm_power_info apm_info;
|
||||
- int apm_fd, ac_status, charging;
|
||||
+ int apm_fd;
|
||||
|
||||
apm_fd = open("/dev/apm", O_RDONLY);
|
||||
if (apm_fd < 0) {
|
||||
@@ -249,26 +249,41 @@ void print_battery_info(yajl_gen json_gen, char *buffe
|
||||
|
||||
switch(apm_info.ac_state) {
|
||||
case APM_AC_OFF:
|
||||
- ac_status = CS_DISCHARGING;
|
||||
+ status = CS_DISCHARGING;
|
||||
break;
|
||||
case APM_AC_ON:
|
||||
- ac_status = CS_CHARGING;
|
||||
+ status = CS_CHARGING;
|
||||
break;
|
||||
default:
|
||||
/* If we don't know what's going on, just assume we're discharging. */
|
||||
- ac_status = CS_DISCHARGING;
|
||||
+ status = CS_DISCHARGING;
|
||||
break;
|
||||
}
|
||||
|
||||
(void)snprintf(statusbuf, sizeof(statusbuf), "%s", BATT_STATUS_NAME(status));
|
||||
(void)snprintf(percentagebuf, sizeof(percentagebuf), "%02d%%", apm_info.battery_life);
|
||||
|
||||
+ if (status == CS_DISCHARGING && low_threshold > 0) {
|
||||
+ if (strncmp(threshold_type, "percentage", strlen(threshold_type)) == 0
|
||||
+ && apm_info.battery_life < low_threshold) {
|
||||
+ START_COLOR("color_bad");
|
||||
+ colorful_output = true;
|
||||
+ } else if (strncmp(threshold_type, "time", strlen(threshold_type)) == 0
|
||||
+ && apm_info.minutes_left < (u_int) low_threshold) {
|
||||
+ START_COLOR("color_bad");
|
||||
+ colorful_output = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/* Can't give a meaningful value for remaining minutes if we're charging. */
|
||||
- if (ac_status == CS_CHARGING)
|
||||
- charging = 1;
|
||||
+ if (status != CS_CHARGING) {
|
||||
+ (void)snprintf(remainingbuf, sizeof(remainingbuf), "%d", apm_info.minutes_left);
|
||||
+ } else {
|
||||
+ (void)snprintf(remainingbuf, sizeof(remainingbuf), "%s", "(CHR)");
|
||||
+ }
|
||||
|
||||
- (void)snprintf(remainingbuf, sizeof(remainingbuf), (charging ? "%s" : "%d"),
|
||||
- (charging ? "(CHR)" : apm_info.minutes_left));
|
||||
+ if (colorful_output)
|
||||
+ END_COLOR;
|
||||
#endif
|
||||
|
||||
#define EAT_SPACE_FROM_OUTPUT_IF_EMPTY(_buf) \
|
@ -1,94 +0,0 @@
|
||||
$OpenBSD: patch-src_print_cpu_temperature_c,v 1.6 2012/10/16 10:40:21 jasper Exp $
|
||||
|
||||
From ae4873bac793245e7dea4719c8e0d1c7bc990d5f Mon Sep 17 00:00:00 2001
|
||||
From: Jasper Lievisse Adriaanse <jasper@openbsd.org>
|
||||
Date: Wed, 10 Oct 2012 07:57:32 +0000
|
||||
Subject: i3status - More temperature related fixes for OpenBSD, and a general feature
|
||||
|
||||
|
||||
From 1c2517a3998385dbfca0559aca3ba7e72b5c216c Mon Sep 17 00:00:00 2001
|
||||
From: Jasper Lievisse Adriaanse <jasper@openbsd.org>
|
||||
Date: Wed, 10 Oct 2012 07:53:34 +0000
|
||||
Subject: i3status - Default to acpitz(4) instead of cpu(4) for OpenBSD temperature readings
|
||||
|
||||
--- src/print_cpu_temperature.c.orig Wed Oct 3 13:44:44 2012
|
||||
+++ src/print_cpu_temperature.c Tue Oct 9 20:36:23 2012
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <sys/sensors.h>
|
||||
#include <errno.h>
|
||||
#include <err.h>
|
||||
+
|
||||
+#define MUKTOC(v) ((v - 273150000) / 1000000.0)
|
||||
#endif
|
||||
|
||||
static char *thermal_zone;
|
||||
@@ -32,11 +34,11 @@ static char *thermal_zone;
|
||||
* returns the temperature in degree celcius.
|
||||
*
|
||||
*/
|
||||
-void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const char *path, const char *format) {
|
||||
+void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const char *path, const char *format, int max_threshold) {
|
||||
#ifdef THERMAL_ZONE
|
||||
const char *walk;
|
||||
char *outwalk = buffer;
|
||||
- static char buf[16];
|
||||
+ bool colorful_output;
|
||||
|
||||
if (path == NULL)
|
||||
asprintf(&thermal_zone, THERMAL_ZONE, zone);
|
||||
@@ -54,6 +56,7 @@ void print_cpu_temperature_info(yajl_gen json_gen, cha
|
||||
|
||||
if (BEGINS_WITH(walk+1, "degrees")) {
|
||||
#if defined(LINUX)
|
||||
+ static char buf[16];
|
||||
long int temp;
|
||||
if (!slurp(path, buf, sizeof(buf)))
|
||||
goto error;
|
||||
@@ -87,21 +90,27 @@ void print_cpu_temperature_info(yajl_gen json_gen, cha
|
||||
break;
|
||||
goto error;
|
||||
}
|
||||
- /*
|
||||
- * 'path' is actually the node within the full path (eg, cpu0).
|
||||
- * 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.
|
||||
- */
|
||||
+ /* 'path' is the node within the full path (defaults to acpitz0). */
|
||||
if (strncmp(sensordev.xname, path, strlen(path)) == 0) {
|
||||
mib[3] = SENSOR_TEMP;
|
||||
- for (numt = 0; numt < sensordev.maxnumt[SENSOR_TEMP]; numt++) {
|
||||
+ /* Limit to temo0, but should retrieve from a full path... */
|
||||
+ for (numt = 0; numt < 1 /*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 );
|
||||
+ if ((int)MUKTOC(sensor.value) >= max_threshold) {
|
||||
+ START_COLOR("color_bad");
|
||||
+ colorful_output = true;
|
||||
+ }
|
||||
+
|
||||
+ outwalk += sprintf(outwalk, "%.2f", MUKTOC(sensor.value));
|
||||
+
|
||||
+ if (colorful_output)
|
||||
+ END_COLOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,9 +118,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);
|
@ -1,60 +0,0 @@
|
||||
$OpenBSD: patch-src_print_eth_info_c,v 1.2 2012/10/10 07:20:16 jasper Exp $
|
||||
|
||||
From 11c4ab9870174505786696b0da0331d53067fe1f Mon Sep 17 00:00:00 2001
|
||||
From: Jasper Lievisse Adriaanse <jasper@humppa.nl>
|
||||
Date: Mon, 08 Oct 2012 20:13:47 +0000
|
||||
Subject: Implement %speed for Ethernet on OpenBSD.
|
||||
|
||||
--- src/print_eth_info.c.orig Mon Oct 8 18:39:07 2012
|
||||
+++ src/print_eth_info.c Mon Oct 8 18:39:23 2012
|
||||
@@ -25,7 +25,11 @@
|
||||
(IFM_TYPE((dt)) == 0 || IFM_TYPE((dt)) == IFM_TYPE((t)))
|
||||
|
||||
#define PART_ETHSPEED "E: %s (%s)"
|
||||
+#endif
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
+#include <errno.h>
|
||||
+#include <net/if_media.h>
|
||||
#endif
|
||||
|
||||
static int print_eth_speed(char *outwalk, const char *interface) {
|
||||
@@ -65,6 +69,38 @@ static int print_eth_speed(char *outwalk, const char *
|
||||
}
|
||||
ethspeed = (desc->ifmt_string != NULL ? desc->ifmt_string : "?");
|
||||
return sprintf(outwalk, "%s", ethspeed);
|
||||
+#elif defined(__OpenBSD__)
|
||||
+ char *ethspeed;
|
||||
+ struct ifmediareq ifmr;
|
||||
+
|
||||
+ (void) memset(&ifmr, 0, sizeof(ifmr));
|
||||
+ (void) strlcpy(ifmr.ifm_name, interface, sizeof(ifmr.ifm_name));
|
||||
+
|
||||
+ if (ioctl(general_socket, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
|
||||
+ if (errno != E2BIG)
|
||||
+ return sprintf(outwalk, "?");
|
||||
+ }
|
||||
+
|
||||
+ struct ifmedia_description *desc;
|
||||
+ struct ifmedia_description ifm_subtype_descriptions[] =
|
||||
+ IFM_SUBTYPE_DESCRIPTIONS;
|
||||
+
|
||||
+ for (desc = ifm_subtype_descriptions; desc->ifmt_string != NULL; desc++) {
|
||||
+ /*
|
||||
+ * Skip these non-informative values and go right ahead to the
|
||||
+ * actual speeds.
|
||||
+ */
|
||||
+ if (strncmp(desc->ifmt_string, "autoselect", strlen("autoselect")) == 0 ||
|
||||
+ strncmp(desc->ifmt_string, "auto", strlen("auto")) == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ if (IFM_TYPE_MATCH(desc->ifmt_word, ifmr.ifm_active) &&
|
||||
+ IFM_SUBTYPE(desc->ifmt_word) == IFM_SUBTYPE(ifmr.ifm_active))
|
||||
+ break;
|
||||
+ }
|
||||
+ ethspeed = (desc->ifmt_string != NULL ? desc->ifmt_string : "?");
|
||||
+ return sprintf(outwalk, "%s", ethspeed);
|
||||
+
|
||||
#else
|
||||
return sprintf(outwalk, "?");
|
||||
#endif
|
@ -1,25 +0,0 @@
|
||||
$OpenBSD: patch-src_print_volume_c,v 1.4 2012/10/04 08:41:01 jasper Exp $
|
||||
|
||||
From 7dcc961fa2d755ed47b29de778a2d2baf8dac7ba Mon Sep 17 00:00:00 2001
|
||||
From: Michael Stapelberg <michael@stapelberg.de>
|
||||
Date: Wed, 03 Oct 2012 13:12:49 +0000
|
||||
Subject: Bugfix: Move the pbval definition outside the ifdef
|
||||
|
||||
--- src/print_volume.c.orig Wed Oct 3 13:44:44 2012
|
||||
+++ src/print_volume.c Thu Oct 4 08:30:22 2012
|
||||
@@ -51,6 +51,7 @@ static void free_hdl(struct mixer_hdl *hdl) {
|
||||
|
||||
void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char *device, const char *mixer, int mixer_idx) {
|
||||
char *outwalk = buffer;
|
||||
+ int pbval = 1;
|
||||
|
||||
/* Printing volume only works with ALSA at the moment */
|
||||
if (output_format == O_I3BAR) {
|
||||
@@ -173,6 +174,7 @@ void print_volume(yajl_gen json_gen, char *buffer, con
|
||||
walk += strlen("volume");
|
||||
}
|
||||
}
|
||||
+
|
||||
#endif
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
char mixerpath[] = "/dev/mixer";
|
@ -1,139 +0,0 @@
|
||||
$OpenBSD: patch-src_print_wireless_info_c,v 1.5 2012/10/16 10:40:21 jasper Exp $
|
||||
|
||||
From 794151cfe76f80fb2c7eebb8d3fbbce8fc5ccb09 Mon Sep 17 00:00:00 2001
|
||||
From: Jasper Lievisse Adriaanse <jasper@humppa.nl>
|
||||
Date: Mon, 08 Oct 2012 20:15:14 +0000
|
||||
Subject: Implement %essid and %signal for wireless on OpenBSD.
|
||||
|
||||
From ed03d2450ceae3cc7952b65d8349373bbb45a487 Mon Sep 17 00:00:00 2001
|
||||
From: Jasper Lievisse Adriaanse <jasper@openbsd.org>
|
||||
Date: Wed, 10 Oct 2012 07:52:27 +0000
|
||||
Subject: i3status - Handle down wireless interfaces just like ethernet interfaces (e.g. colors)
|
||||
|
||||
--- src/print_wireless_info.c.orig Wed Oct 3 13:44:44 2012
|
||||
+++ src/print_wireless_info.c Tue Oct 9 15:25:03 2012
|
||||
@@ -25,6 +25,17 @@
|
||||
#define IW_ESSID_MAX_SIZE IEEE80211_NWID_LEN
|
||||
#endif
|
||||
|
||||
+#ifdef __OpenBSD__
|
||||
+#include <sys/ioctl.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <net/if.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <netinet/in.h>
|
||||
+#include <netinet/if_ether.h>
|
||||
+#include <net80211/ieee80211.h>
|
||||
+#include <net80211/ieee80211_ioctl.h>
|
||||
+#endif
|
||||
+
|
||||
#include "i3status.h"
|
||||
|
||||
#define WIRELESS_INFO_FLAG_HAS_ESSID (1 << 0)
|
||||
@@ -220,6 +231,70 @@ static int get_wireless_info(const char *interface, wi
|
||||
|
||||
return 1;
|
||||
#endif
|
||||
+#ifdef __OpenBSD__
|
||||
+ struct ifreq ifr;
|
||||
+ struct ieee80211_bssid bssid;
|
||||
+ struct ieee80211_nwid nwid;
|
||||
+ struct ieee80211_nodereq nr;
|
||||
+
|
||||
+ struct ether_addr ea;
|
||||
+
|
||||
+ int s, len, ibssid, inwid;
|
||||
+ u_int8_t zero_bssid[IEEE80211_ADDR_LEN];
|
||||
+
|
||||
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
|
||||
+ return (0);
|
||||
+
|
||||
+ memset(&ifr, 0, sizeof(ifr));
|
||||
+ ifr.ifr_data = (caddr_t)&nwid;
|
||||
+ (void)strlcpy(ifr.ifr_name, interface, sizeof(ifr.ifr_name));
|
||||
+ inwid = ioctl(s, SIOCG80211NWID, (caddr_t)&ifr);
|
||||
+
|
||||
+ memset(&bssid, 0, sizeof(bssid));
|
||||
+ strlcpy(bssid.i_name, interface, sizeof(bssid.i_name));
|
||||
+ ibssid = ioctl(s, SIOCG80211BSSID, &bssid);
|
||||
+
|
||||
+ if (ibssid != 0 || inwid != 0) {
|
||||
+ close(s);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* NWID */
|
||||
+ {
|
||||
+ if (nwid.i_len <= IEEE80211_NWID_LEN)
|
||||
+ len = nwid.i_len + 1;
|
||||
+ else
|
||||
+ len = IEEE80211_NWID_LEN + 1;
|
||||
+
|
||||
+ strncpy(&info->essid[0], nwid.i_nwid, len);
|
||||
+ info->essid[IW_ESSID_MAX_SIZE] = '\0';
|
||||
+ info->flags |= WIRELESS_INFO_FLAG_HAS_ESSID;
|
||||
+ }
|
||||
+
|
||||
+ /* Signal strength */
|
||||
+ {
|
||||
+ memset(&zero_bssid, 0, sizeof(zero_bssid));
|
||||
+ if (ibssid == 0 && memcmp(bssid.i_bssid, zero_bssid, IEEE80211_ADDR_LEN) != 0) {
|
||||
+ memcpy(&ea.ether_addr_octet, bssid.i_bssid, sizeof(ea.ether_addr_octet));
|
||||
+
|
||||
+ bzero(&nr, sizeof(nr));
|
||||
+ bcopy(bssid.i_bssid, &nr.nr_macaddr, sizeof(nr.nr_macaddr));
|
||||
+ strlcpy(nr.nr_ifname, interface, sizeof(nr.nr_ifname));
|
||||
+
|
||||
+ if (ioctl(s, SIOCG80211NODE, &nr) == 0 && nr.nr_rssi) {
|
||||
+ if (nr.nr_max_rssi)
|
||||
+ info->signal_level_max = IEEE80211_NODEREQ_RSSI(&nr);
|
||||
+ else
|
||||
+ info->signal_level = nr.nr_rssi;
|
||||
+
|
||||
+ info->flags |= WIRELESS_INFO_FLAG_HAS_SIGNAL;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ close(s);
|
||||
+ return 1;
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -230,6 +305,15 @@ void print_wireless_info(yajl_gen json_gen, char *buff
|
||||
|
||||
INSTANCE(interface);
|
||||
|
||||
+ const char *ip_address = get_ip_addr(interface);
|
||||
+ if (ip_address == NULL) {
|
||||
+ START_COLOR("color_bad");
|
||||
+ outwalk += sprintf(outwalk, "%s", format_down);
|
||||
+ goto out;
|
||||
+ } else {
|
||||
+ START_COLOR("color_good");
|
||||
+ }
|
||||
+
|
||||
if (get_wireless_info(interface, &info)) {
|
||||
walk = format_up;
|
||||
if (info.flags & WIRELESS_INFO_FLAG_HAS_QUALITY)
|
||||
@@ -291,9 +375,8 @@ void print_wireless_info(yajl_gen json_gen, char *buff
|
||||
}
|
||||
|
||||
if (BEGINS_WITH(walk+1, "ip")) {
|
||||
- const char *ip_address = get_ip_addr(interface);
|
||||
- outwalk += sprintf(outwalk, "%s", (ip_address ? ip_address : "no IP"));
|
||||
- walk += strlen("ip");
|
||||
+ outwalk += sprintf(outwalk, "%s", ip_address);
|
||||
+ walk += strlen("ip");
|
||||
}
|
||||
|
||||
#ifdef LINUX
|
||||
@@ -308,6 +391,7 @@ void print_wireless_info(yajl_gen json_gen, char *buff
|
||||
#endif
|
||||
}
|
||||
|
||||
+out:
|
||||
END_COLOR;
|
||||
OUTPUT_FULL_TEXT(buffer);
|
||||
}
|
Loading…
Reference in New Issue
Block a user