From 83d0b621c0b7ea0ffcf793e7fb4e0decdef63f3b Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Mon, 4 Sep 2017 13:24:54 +0200 Subject: [PATCH 1/3] Remove overly aggressive #error Change-Id: I8c20606d386d713cac51b620d1fcdb479a3622fe --- src/first_network_device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/first_network_device.c b/src/first_network_device.c index 3f34cf2..1ed50a2 100644 --- a/src/first_network_device.c +++ b/src/first_network_device.c @@ -82,8 +82,6 @@ static net_type_t iface_type(const char *ifname) { if (strcmp(devtype, "wwan") == 0) return NET_TYPE_OTHER; - - return NET_TYPE_OTHER; #elif __OpenBSD__ /* *First determine if the device is a wireless device by trying two ioctl(2) @@ -126,9 +124,8 @@ static net_type_t iface_type(const char *ifname) { close(s); return NET_TYPE_ETHERNET; } -#else -#error Missing implementation to determine interface type. #endif + return NET_TYPE_OTHER; } const char *first_eth_interface(const net_type_t type) { From b9b676af20511995e647879992df6a6bee753212 Mon Sep 17 00:00:00 2001 From: Tomas Krizek Date: Sun, 3 Dec 2017 14:46:54 +0100 Subject: [PATCH 2/3] man: explicitly use format_up/format_down in ethernet, wireless conf Clearly indicate format_up and format_down are used for configuring ethernet and wireless sections instead of format. Signed-off-by: Tomas Krizek --- man/i3status.man | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/man/i3status.man b/man/i3status.man index f1b6221..943653e 100644 --- a/man/i3status.man +++ b/man/i3status.man @@ -300,7 +300,9 @@ network interface found on the system (excluding devices starting with "lo"). *Example order*: +wireless wlan0+ -*Example format*: +W: (%quality at %essid, %bitrate / %frequency) %ip+ +*Example format_up*: +W: (%quality at %essid, %bitrate / %frequency) %ip+ + +*Example format_down*: +W: down+ === Ethernet @@ -313,7 +315,9 @@ network interface found on the system (excluding devices starting with "lo"). *Example order*: +ethernet eth0+ -*Example format*: +E: %ip (%speed)+ +*Example format_up*: +E: %ip (%speed)+ + +*Example format_down*: +E: down+ === Battery From 5b416d4ac00caf6028416999d3cef3b997d33f3b Mon Sep 17 00:00:00 2001 From: Carlin Bingham Date: Tue, 13 Feb 2018 02:12:04 +1300 Subject: [PATCH 3/3] OpenBSD: fix volume display on some hardware On some hardware the AUDIO_MIXER_READ ioctl requires the current number of channels to be set, and the mute device found needs to be checked if it belongs to the master output device. --- src/print_volume.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/print_volume.c b/src/print_volume.c index 51e84f3..be6a1d7 100644 --- a/src/print_volume.c +++ b/src/print_volume.c @@ -211,6 +211,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char * #if defined(__OpenBSD__) int oclass_idx = -1, master_idx = -1, master_mute_idx = -1; + int master_next = AUDIO_MIXER_LAST; mixer_devinfo_t devinfo, devinfo2; mixer_ctrl_t vinfo; @@ -228,12 +229,17 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char * devinfo2.index = 0; while (ioctl(mixfd, AUDIO_MIXER_DEVINFO, &devinfo2) >= 0) { - if ((devinfo2.type == AUDIO_MIXER_VALUE) && (devinfo2.mixer_class == oclass_idx) && (strncmp(devinfo2.label.name, AudioNmaster, MAX_AUDIO_DEV_LEN) == 0)) + if ((devinfo2.type == AUDIO_MIXER_VALUE) && (devinfo2.mixer_class == oclass_idx) && (strncmp(devinfo2.label.name, AudioNmaster, MAX_AUDIO_DEV_LEN) == 0)) { master_idx = devinfo2.index; + master_next = devinfo2.next; + } if ((devinfo2.type == AUDIO_MIXER_ENUM) && (devinfo2.mixer_class == oclass_idx) && (strncmp(devinfo2.label.name, AudioNmute, MAX_AUDIO_DEV_LEN) == 0)) - master_mute_idx = devinfo2.index; + if (master_next == devinfo2.index) + master_mute_idx = devinfo2.index; + if (master_next != AUDIO_MIXER_LAST) + master_next = devinfo2.next; devinfo2.index++; } @@ -246,6 +252,7 @@ void print_volume(yajl_gen json_gen, char *buffer, const char *fmt, const char * vinfo.dev = master_idx; vinfo.type = AUDIO_MIXER_VALUE; + vinfo.un.value.num_channels = devinfo.un.v.num_channels; if (ioctl(mixfd, AUDIO_MIXER_READ, &vinfo) == -1) goto out;