summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2025-01-04 10:52:50 +0000
committerFelix Fietkau2025-01-04 10:55:04 +0000
commitb795e5cbcffc54e858bc8d3bde0031a2ca32377e (patch)
treea93fb7182570c900c0e6851a0861e53140dd06e9
parentf11bc4f201e3a4ffec8c1e2083124ebda60dd763 (diff)
downloadopenwrt-b795e5cbcffc54e858bc8d3bde0031a2ca32377e.tar.gz
wifi-scripts: fix setting tx power on some drivers
On some drivers, setting the tx power on the interface is not enough. Set it for the phy as well. Fixes: 04fb05914ea7 ("wifi-scripts: add multi-radio config support") Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rwxr-xr-xpackage/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh1
-rwxr-xr-xpackage/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh8
2 files changed, 9 insertions, 0 deletions
diff --git a/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh
index 93ab404d57..9b86abcee5 100755
--- a/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh
+++ b/package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh
@@ -195,6 +195,7 @@ function setup_phy(phy, config, data) {
log(`Configuring '${phy}' txantenna: ${config.txantenna}, rxantenna: ${config.rxantenna} distance: ${config.distance}`);
system(`iw phy ${phy} set antenna ${config.txantenna} ${config.rxantenna}`);
system(`iw phy ${phy} set distance ${config.distance}`);
+ system(`iw phy ${phy} set txpower ${config.txpower}`);
if (config.frag)
system(`iw phy ${phy} set frag ${frag}`);
diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
index 5d9bf8ee09..9e9922e0b3 100755
--- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
+++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
@@ -1210,6 +1210,14 @@ drv_mac80211_setup() {
wdev_tool "$phy$phy_suffix" set_config "$(json_dump)" $active_ifnames
json_set_namespace "$prev"
+ [ -z "$phy_suffix" ] && {
+ if [ -n "$txpower" ]; then
+ iw phy "$phy" set txpower fixed "${txpower%%.*}00"
+ else
+ iw phy "$phy" set txpower auto
+ fi
+ }
+
for_each_interface "ap sta adhoc mesh monitor" mac80211_set_vif_txpower
wireless_set_up
}