summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Monitors.hs
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2020-02-16 12:40:02 +0300
committerPaul Fertser <fercerpav@gmail.com>2020-02-25 13:07:44 +0300
commitf4555b51b778ae5e677ce63eccdfd9376d07dd5d (patch)
treef7a8f59022efc3396e602c78856958537ca6de4d /src/Xmobar/Plugins/Monitors.hs
parent3f11da6eed40b06044c705db9e3e81fd25abb391 (diff)
downloadxmobar-f4555b51b778ae5e677ce63eccdfd9376d07dd5d.tar.gz
xmobar-f4555b51b778ae5e677ce63eccdfd9376d07dd5d.tar.bz2
Wireless: support NL80211 userspace <-> kernelspace API
NL80211 was introduced in Linux 2.6.24 in 2007 as a new extensible universal API, replacing "wireless extensions" ioctls. It works on top of netlink, and allows direct communication to cfg80211 kernel subsystem. Since then it became a hard requirement for all upstream wireless drivers to hook into cfg80211 (SoftMAC drivers do it via the common mac80211 layer). There's still additional compatibility code that allows limited Wext functionality for cfg80211 drivers but it's buggy and can be disabled altogether when CONFIG_CFG80211_WEXT is not set. This patch makes use of "netlink" Haskell library which doesn't have any additional runtime dependencies (so neither iwlib nor libnl are required). The operation is the same as performed by "iw dev <devname> link" command. The signal level is transformed to "quality" by first clamping it to [-110; -40], then adding 110 and dividing by 70 (same meaningless formula as used by the cfg80211 Wext compatibility layer). "essid" template argument is replaced by more appropriate "ssid" (with the old variant still available for backwards compatibility)
Diffstat (limited to 'src/Xmobar/Plugins/Monitors.hs')
-rw-r--r--src/Xmobar/Plugins/Monitors.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Xmobar/Plugins/Monitors.hs b/src/Xmobar/Plugins/Monitors.hs
index d6fc0a0..322d401 100644
--- a/src/Xmobar/Plugins/Monitors.hs
+++ b/src/Xmobar/Plugins/Monitors.hs
@@ -42,7 +42,7 @@ import Xmobar.Plugins.Monitors.CatInt
#ifdef UVMETER
import Xmobar.Plugins.Monitors.UVMeter
#endif
-#ifdef IWLIB
+#if defined IWLIB || defined USE_NL80211
import Xmobar.Plugins.Monitors.Wireless
#endif
#ifdef LIBMPD
@@ -85,7 +85,7 @@ data Monitors = Network Interface Args Rate
#ifdef UVMETER
| UVMeter Station Args Rate
#endif
-#ifdef IWLIB
+#if defined IWLIB || defined USE_NL80211
| Wireless Interface Args Rate
#endif
#ifdef LIBMPD
@@ -142,7 +142,7 @@ instance Exec Monitors where
#ifdef UVMETER
alias (UVMeter s _ _) = "uv " ++ s
#endif
-#ifdef IWLIB
+#if defined IWLIB || defined USE_NL80211
alias (Wireless i _ _) = i ++ "wi"
#endif
#ifdef LIBMPD
@@ -186,7 +186,7 @@ instance Exec Monitors where
#ifdef UVMETER
start (UVMeter s a r) = startUVMeter s a r
#endif
-#ifdef IWLIB
+#if defined IWLIB || defined USE_NL80211
start (Wireless i a r) = runM a wirelessConfig (runWireless i) r
#endif
#ifdef LIBMPD