@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-config
-PKG_VERSION:=1
+PKG_VERSION:=2
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@@ -28,3 +28,24 @@ poe_passthrough=$(uci -q get "fff.poe_passthrough.active")
if [ "$poe_passthrough" = "1" ] && [ -s /usr/lib/fff-support/activate_poe_passthrough.sh ] ; then
/usr/lib/fff-support/activate_poe_passthrough.sh
fi
+
+. /lib/functions/fff/wireless
+
+if [ "$(uci -q get 'fff.wifi.disable24ghz')" = "1" ] ; then
+ radio="$(wifiGetPhy "2")"
+ [ -n "$radio" ] && uci -q set "wireless.${radio}.disabled=1"
+fi
+
+if [ "$(uci -q get 'fff.wifi.disable5ghz')" = "1" ] ; then
+ radio="$(wifiGetPhy "5")"
+ [ -n "$radio" ] && uci -q set "wireless.${radio}.disabled=1"
+fi
+
+if [ "$(uci -q get 'fff.wifi.disablewifi')" = "1" ] ; then
+ for phy in $(iw phy | awk '/^Wiphy/{ print $2 }'); do
+ radio="radio$(echo "$phy" | tr -d -C "0-9")"
+ uci -q set "wireless.${radio}.disabled=1"
+ done
+fi
+
+uci -q commit wireless
@@ -228,4 +228,26 @@ wifiAddMesh() {
echo "${iface}"
return 0
}
+
+wifiGetPhy() {
+ # Returns the wifi-device (radioX) for a given frequency (2 or 5)
+
+ if [ $# -ne "1" ]
+ then
+ return 1
+ fi
+
+ local freq=$1
+ local radio=""
+
+ for phy in $(iw phy | awk '/^Wiphy/{ print $2 }'); do
+ if iw phy "$phy" info | grep -q -m1 "${freq}... MHz"; then
+ radio="radio$(echo "$phy" | tr -d -C "0-9")"
+ fi
+ done
+
+ echo "$radio"
+ return 0 # also returns success if outermost if is false
+}
+
# vim: set noexpandtab:tabstop=4