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
This commit is contained in:
Conrad Lara - KG6JEI 2015-06-18 18:57:04 -07:00
parent d1253c0d9d
commit ee90c366aa
4 changed files with 7 additions and 92 deletions

View File

@ -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} = wifi_maxpower() if not defined $cfg{wifi_txpower} or $cfg{wifi_txpower} > wifi_maxpower();
$cfg{wifi_txpower} = 1 if $cfg{wifi_txpower} < 1; $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"; 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}) 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 # indicate whether lan is running in dmz mode
system "echo $cfg{dmz_mode} > /etc/config/dmz-mode" if $cfg{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 # Setup node lan dhcp
if ( $cfg{lan_dhcp_noroute} ) { if ( $cfg{lan_dhcp_noroute} ) {
$cmd .= "uci add_list dhcp.\@dhcp[0].dhcp_option=3 >/dev/null 2>&1;" $cmd .= "uci add_list dhcp.\@dhcp[0].dhcp_option=3 >/dev/null 2>&1;"

View File

@ -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 <http://www.gnu.org/licenses/>.
=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`;
}
}

View File

@ -136,19 +136,6 @@ unless($parms{reload})
if ( $doesiwoffset ) { if ( $doesiwoffset ) {
$wifi_txpower -= $1; $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 = ""; $slottime = "";
} }
@ -176,16 +163,6 @@ if($parms{button_apply} or $parms{button_save})
{ {
my $wifiintf = get_interface("wifi"); my $wifiintf = get_interface("wifi");
$cmd = ""; $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 phy phy0 set distance $wifi_distance >/dev/null 2>&1;";
$cmd .= "iw dev $wifiintf set txpower fixed ${wifi_txpower}00 >/dev/null 2>&1;"; $cmd .= "iw dev $wifiintf set txpower fixed ${wifi_txpower}00 >/dev/null 2>&1;";
system $cmd; system $cmd;
@ -623,20 +600,7 @@ if($wifi_proto ne "disabled")
print "<tr><td colspan=2 align=center><hr><small>Active Settings</small></td></tr>\n"; print "<tr><td colspan=2 align=center><hr><small>Active Settings</small></td></tr>\n";
print "<tr><td><nobr>Rx Antenna</nobr></td>\n"; print "<tr><td>Antenna selection is now automatic"
print "<td><select name=wifi_rxant>\n";
$validants = wifi_validant();
while (($value, $name) = each (%{$validants})){
selopt($name, $value, $wifi_rxant);
}
print "</select></td></tr>\n";
print "<tr><td><nobr>Tx Antenna</nobr></td>\n";
print "<td><select name=wifi_txant>\n";
while (($value, $name) = each (%{$validants})){
selopt($name, $value, $wifi_txant);
}
print "</select></td></tr>\n";
print "<tr><td><nobr>Tx Power</nobr></td>\n"; print "<tr><td><nobr>Tx Power</nobr></td>\n";
print "<td><select name=wifi_txpower>\n"; print "<td><select name=wifi_txpower>\n";

View File

@ -277,10 +277,12 @@ In the <strong>WiFi</strong> box there are settings shown as being
Active Settings. These settings can be changed without rebooting the node by Active Settings. These settings can be changed without rebooting the node by
clicking the <strong>Apply</strong> button, but unless they are saved they clicking the <strong>Apply</strong> button, but unless they are saved they
will revert to the previously saved values after a reboot.<br> <br> will revert to the previously saved values after a reboot.<br> <br>
The <strong>Rx Antenna</strong> and <strong>Tx Antenna</strong> settings are The <strong>Rx Antenna</strong> and <strong>Tx Antenna</strong> settings have
named to match either the printed name on the antenna connector or in the been removed from current builds. The hardware handles antenna selection
case of units that have a built in antenna the names are for units mounted automatically in the backend without need for configuration.
in its normal orientation. <br>
As always a dummy load on unused RF ports is recommended to keep out physical
contaminants and to avoid EMI/RFI interference.
</p> </p>
<p> <p>
The <strong>Distance</strong> setting adjusts the packet retry timer The <strong>Distance</strong> setting adjusts the packet retry timer