aredn/patches/712-auto-distance-settings....

16 lines
611 B
Diff

--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -1102,7 +1102,11 @@
wireless_set_data phy="$phy" txantenna="$txantenna" rxantenna="$rxantenna"
iw phy "$phy" set antenna $txantenna $rxantenna >/dev/null 2>&1
- iw phy "$phy" set distance "$distance" >/dev/null 2>&1
+ if [ $distance -eq 0 -a -d /sys/kernel/debug/ieee80211/$phy/ath9k ]; then
+ iw phy "$phy" set distance auto
+ else
+ iw phy "$phy" set distance "$distance"
+ fi
if [ -n "$txpower" ]; then
iw phy "$phy" set txpower fixed "${txpower%%.*}00"