madwifi: add config option for adjusting the beacon power relative to the full tx...
[openwrt/svn-archive/archive.git] / package / madwifi / files / lib / wifi / madwifi.sh
index 550bba7e552af968e3996f004c21f0a8ce4bee4f..3c4112a4ffe021794e80544aa4a10fbe414354ac 100755 (executable)
@@ -78,12 +78,13 @@ enable_atheros() {
        fi
        config_get channel "$device" channel
        config_get vifs "$device" vifs
+       config_get txpower "$device" txpower
 
        [ auto = "$channel" ] && channel=0
 
        local first=1
        for vif in $vifs; do
-               local start_hostapd
+               local start_hostapd vif_txpower
                nosbeacon=
                config_get ifname "$vif" ifname
                config_get enc "$vif" encryption
@@ -256,6 +257,9 @@ enable_atheros() {
                config_get_bool turbo "$vif" turbo
                [ -n "$turbo" ] && iwpriv "$ifname" turbo "$turbo"
 
+               config_get_bool beacon_power "$vif" beacon_power
+               [ -n "$beacon_power" ] && iwpriv "$ifname" beacon_pwr "$beacon_power"
+
                config_get_bool doth "$vif" doth 0
                [ -n "$doth" ] && iwpriv "$ifname" doth "$doth"
 
@@ -299,8 +303,14 @@ enable_atheros() {
                set_wifi_up "$vif" "$ifname"
 
                # TXPower settings only work if device is up already
-               config_get txpwr "$vif" txpower
-               [ -n "$txpwr" ] && iwconfig "$ifname" txpower "${txpwr%%.*}"
+               # while atheros hardware theoretically is capable of per-vif (even per-packet) txpower
+               # adjustment it does not work with the current atheros hal/madwifi driver
+
+               config_get vif_txpower "$vif" txpower
+               # use vif_txpower (from wifi-iface) instead of txpower (from wifi-device) if
+               # the latter doesn't exist
+               txpower="${txpower:-$vif_txpower}"
+               [ -z "$txpower" ] || iwconfig "$ifname" txpower "${txpower%%.*}"
 
                case "$mode" in
                        ap)