From f4555b51b778ae5e677ce63eccdfd9376d07dd5d Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Sun, 16 Feb 2020 12:40:02 +0300 Subject: 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 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) --- src/Xmobar/Plugins/Monitors.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Xmobar/Plugins/Monitors.hs') 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 -- cgit v1.2.3