add support for showing signal quality in i3status;
if the signal strength is in dBm try a simple approach to convert it to percentage take maintainership while here; ok jasper@
This commit is contained in:
parent
dc6e5af6a6
commit
eb27a92975
@ -1,16 +1,16 @@
|
||||
# $OpenBSD: Makefile,v 1.61 2020/08/03 12:38:14 jcs Exp $
|
||||
# $OpenBSD: Makefile,v 1.62 2021/07/13 19:26:00 robert Exp $
|
||||
|
||||
ONLY_FOR_ARCHS= ${APM_ARCHS}
|
||||
|
||||
COMMENT= generate a statusbar for use with i3/xmobar/dzen2
|
||||
|
||||
DISTNAME= i3status-2.13
|
||||
REVISION= 4
|
||||
REVISION= 5
|
||||
CATEGORIES= x11 sysutils
|
||||
|
||||
HOMEPAGE= https://i3wm.org/i3status/
|
||||
|
||||
MAINTAINER= Jasper Lievisse Adriaanse <jasper@openbsd.org>
|
||||
MAINTAINER= Robert Nagy <robert@openbsd.org>
|
||||
|
||||
# BSD
|
||||
PERMIT_PACKAGE = Yes
|
||||
|
28
x11/i3status/patches/patch-src_print_wireless_info_c
Normal file
28
x11/i3status/patches/patch-src_print_wireless_info_c
Normal file
@ -0,0 +1,28 @@
|
||||
$OpenBSD: patch-src_print_wireless_info_c,v 1.16 2021/07/13 19:26:00 robert Exp $
|
||||
|
||||
Index: src/print_wireless_info.c
|
||||
--- src/print_wireless_info.c.orig
|
||||
+++ src/print_wireless_info.c
|
||||
@@ -451,9 +451,21 @@ error1:
|
||||
|
||||
if (ioctl(s, SIOCG80211NODE, &nr) == 0 && nr.nr_rssi) {
|
||||
info->signal_level = nr.nr_rssi;
|
||||
- if (nr.nr_max_rssi)
|
||||
+ if (nr.nr_max_rssi) {
|
||||
info->signal_level_max = nr.nr_max_rssi;
|
||||
+ info->quality = IEEE80211_NODEREQ_RSSI(&nr);
|
||||
+ } else {
|
||||
+ if (info->signal_level <= -100)
|
||||
+ info->quality = 0;
|
||||
+ else if (info->signal_level > -50)
|
||||
+ info->quality = 100;
|
||||
+ else
|
||||
+ info->quality = abs(2*(info->signal_level+100));
|
||||
+ }
|
||||
+ info->quality_max = 100;
|
||||
+ info->quality_average = 50;
|
||||
|
||||
+ info->flags |= WIRELESS_INFO_FLAG_HAS_QUALITY;
|
||||
info->flags |= WIRELESS_INFO_FLAG_HAS_SIGNAL;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user