From ee90c366aabbc2195774426d61a5eb65948ebbf4 Mon Sep 17 00:00:00 2001 From: Conrad Lara - KG6JEI Date: Thu, 18 Jun 2015 18:57:04 -0700 Subject: [PATCH] bugfix: The 'hack' we have been using to set RF chain has been discontinued. Trying to registry over-write the antenna setting has never been a good idea in the first place. The hardware fully handles antenna selection without forcing it already. ref AREDN->ticket:120 --- files/usr/local/bin/node-setup | 13 --------- files/usr/local/bin/wifi-onbootchains | 38 --------------------------- files/www/cgi-bin/setup | 38 +-------------------------- files/www/help.html | 10 ++++--- 4 files changed, 7 insertions(+), 92 deletions(-) delete mode 100755 files/usr/local/bin/wifi-onbootchains diff --git a/files/usr/local/bin/node-setup b/files/usr/local/bin/node-setup index b340ddd8..4c958824 100755 --- a/files/usr/local/bin/node-setup +++ b/files/usr/local/bin/node-setup @@ -422,9 +422,6 @@ unless($cfg{wifi_proto} eq "disabled") { $cfg{wifi_txpower} = wifi_maxpower() if not defined $cfg{wifi_txpower} or $cfg{wifi_txpower} > wifi_maxpower(); $cfg{wifi_txpower} = 1 if $cfg{wifi_txpower} < 1; - if(wifi_useschains()){ - print FILE "/usr/local/bin/wifi-onbootchains\n"; - } print FILE "/usr/sbin/iw dev wlan0 set txpower fixed $cfg{wifi_txpower}00\n"; if(defined $cfg{aprs_lat} and defined $cfg{aprs_lon}) { @@ -493,16 +490,6 @@ if(-f "/etc/config.$config/olsrd") # indicate whether lan is running in dmz mode system "echo $cfg{dmz_mode} > /etc/config/dmz-mode" if $cfg{dmz_mode}; -# Set chains/antenna config elements as they are no longer in the template files - -if(wifi_useschains()){ - $cmd .= "uci set wireless.\@wifi-device[0].rxchain=$cfg{wifi_rxant} >/dev/null 2>&1;"; - $cmd .= "uci set wireless.\@wifi-device[0].txchain=$cfg{wifi_txant} >/dev/null 2>&1;"; -} else { - $cmd .= "uci set wireless.\@wifi-device[0].rxantenna=$cfg{wifi_rxant} >/dev/null 2>&1;"; - $cmd .= "uci set wireless.\@wifi-device[0].txantenna=$cfg{wifi_txant} >/dev/null 2>&1;"; -} - # Setup node lan dhcp if ( $cfg{lan_dhcp_noroute} ) { $cmd .= "uci add_list dhcp.\@dhcp[0].dhcp_option=3 >/dev/null 2>&1;" diff --git a/files/usr/local/bin/wifi-onbootchains b/files/usr/local/bin/wifi-onbootchains deleted file mode 100755 index fa84a6dc..00000000 --- a/files/usr/local/bin/wifi-onbootchains +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/perl -w -I/www/cgi-bin -=for commnet - - Part of AREDN -- Used for creating Amateur Radio Emergency Data Networks - Copyright (C) 2015 Conrad Lara - See Contributors file for additional contributors - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation version 3 of the License. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -=cut - -use perlfunc; - -if (wifi_useschains()){ - - $wifi_rxant = `uci -q get wireless.\@wifi-device[0].rxchain`; - $wifi_txant = `uci -q get wireless.\@wifi-device[0].txchain`; - chomp($wifi_rxant); - chomp($wifi_txant); - - if ( $wifi_rxant ne "" ) { - `echo $wifi_rxant > /sys/kernel/debug/ieee80211/phy0/ath9k/rx_chainmask`; - } - - if ( $wifi_txant ne "" ) { - `echo $wifi_txant > /sys/kernel/debug/ieee80211/phy0/ath9k/tx_chainmask`; - } -} diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index 8e9a1985..90d39412 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -136,19 +136,6 @@ unless($parms{reload}) if ( $doesiwoffset ) { $wifi_txpower -= $1; } - if (wifi_useschains()){ - $wifi_txant = `cat /sys/kernel/debug/ieee80211/phy0/ath9k/tx_chainmask`; - $wifi_rxant = `cat /sys/kernel/debug/ieee80211/phy0/ath9k/rx_chainmask`; - $wifi_txant = hex($wifi_txant); - $wifi_rxant = hex($wifi_rxant); - } - else { - foreach ( `iw phy phy0 info` ) { - next unless /Configured Antennas: TX 0x([\d]+) RX 0x([\d]+)/; - $wifi_txant = $1; - $wifi_rxant = $2; - } - } $slottime = ""; } @@ -176,16 +163,6 @@ if($parms{button_apply} or $parms{button_save}) { my $wifiintf = get_interface("wifi"); $cmd = ""; - if(wifi_useschains()){ - $cmd .= "echo $wifi_rxant > /sys/kernel/debug/ieee80211/phy0/ath9k/rx_chainmask;"; - $cmd .= "echo $wifi_txant > /sys/kernel/debug/ieee80211/phy0/ath9k/tx_chainmask;"; - } else { - $cmd .= "ifdown wifi >/dev/null 2>&1;"; - $cmd .= "ifdown wifi_mon >/dev/null 2>&1;"; - $cmd .= "iw phy phy0 set antenna $wifi_txantenna $wifi_rxantenna >/dev/null 2>&1;"; - $cmd .= "ifup wifi >/dev/null 2>&1;"; - $cmd .= "ifup wifi_mon >/dev/null 2>&1;"; - } $cmd .= "iw phy phy0 set distance $wifi_distance >/dev/null 2>&1;"; $cmd .= "iw dev $wifiintf set txpower fixed ${wifi_txpower}00 >/dev/null 2>&1;"; system $cmd; @@ -623,20 +600,7 @@ if($wifi_proto ne "disabled") print "
Active Settings\n"; - print "Rx Antenna\n"; - print "\n"; - - print "Tx Antenna\n"; - print "\n"; + print "Antenna selection is now automatic" print "Tx Power\n"; print "