Merge branch 'RemoveAntSelector' into release-3.15.1.0

bugfix: antenna selector does not function:  Remove selector.

The antenna selector was a hold back to older hardware where both antennas were not used fully.
In all current hardware the system detects the antennas and handles the RF path for us.

The 'hack' we had been using to set the system to use only a single chain no longer works, and since it was a 'hack' to being with (that could cause other issues) it is best to remove it and let the hardware do what it does best.

Dummy loads are still recomended on unused ports for RFI/EMI and keeping the port clean.

fixes AREDN->ticket:120
This commit is contained in:
Conrad Lara - KG6JEI 2015-06-18 21:19:44 -07:00
commit f0a436333b
5 changed files with 7 additions and 198 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} = 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;"

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

@ -938,8 +938,6 @@ sub hardware_info
'supported' => '-2',
'maxpower' => '27',
'pwroffset' => '0',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
'defaultant' => 3,
'usechains' => 1,
'rfband' => '2400',
},
@ -949,8 +947,6 @@ sub hardware_info
'supported' => '-2',
'maxpower' => '27',
'pwroffset' => '0',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
'defaultant' => 3,
'usechains' => 1,
'rfband' => '5800ubntus',
},
@ -965,8 +961,6 @@ sub hardware_info
'supported' => '-2',
'maxpower' => '16',
'pwroffset' => '4',
'antennas' => { 1 => 'Antenna' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '2400',
},
@ -976,8 +970,6 @@ sub hardware_info
'supported' => '-2',
'maxpower' => '19',
'pwroffset' => '10',
'antennas' => { 1 => 'Antenna' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '2400',
},
@ -987,8 +979,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '22',
'pwroffset' => '6',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
'defaultant' => 3,
'usechains' => 1,
'rfband' => '900',
},
@ -998,8 +988,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '18',
'pwroffset' => '10',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
'defaultant' => 3,
'usechains' => 1,
'rfband' => '2400',
},
@ -1009,8 +997,6 @@ sub hardware_info
'supported' => '-2',
'maxpower' => '22',
'pwroffset' => '3',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
'defaultant' => 3,
'usechains' => 1,
'rfband' => '3400',
},
@ -1020,8 +1006,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '18',
'pwroffset' => '5',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
'defaultant' => 3,
'usechains' => 1,
'rfband' => '2400',
},
@ -1031,8 +1015,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '18',
'pwroffset' => '10',
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
'defaultant' => 3,
'usechains' => 1,
'rfband' => '2400',
},
@ -1042,8 +1024,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '22',
'pwroffset' => '5',
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
'defaultant' => 3,
'usechains' => 1,
'rfband' => '5800ubntus',
},
@ -1053,8 +1033,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '22',
'pwroffset' => '6',
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
'defaultant' => 3,
'usechains' => 1,
'rfband' => '900',
},
@ -1064,8 +1042,6 @@ sub hardware_info
'supported' => '-2',
'maxpower' => '22',
'pwroffset' => '3',
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
'defaultant' => 3,
'usechains' => 1,
'rfband' => '3400',
},
@ -1075,8 +1051,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '16',
'pwroffset' => '12',
'antennas' => { 1 => 'N Connector' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '2400',
},
@ -1086,8 +1060,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '19',
'pwroffset' => '6',
'antennas' => { 1 => 'N Connector' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '5800ubntus',
},
@ -1097,8 +1069,6 @@ sub hardware_info
'supported' => '-2',
'maxpower' => '28',
'pwroffset' => '0',
'antennas' => { 1 => 'airGrid' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '2400',
},
@ -1108,8 +1078,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '19',
'pwroffset' => '1',
'antennas' => { 1 => 'airGrid' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '5800ubntus',
},
@ -1119,8 +1087,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '21',
'pwroffset' => '2',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
'defaultant' => 3,
'usechains' => 1,
'rfband' => '2400',
},
@ -1130,8 +1096,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '22',
'pwroffset' => '6',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
'defaultant' => 3,
'usechains' => 1,
'rfband' => '900',
},
@ -1141,8 +1105,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '19',
'pwroffset' => '9',
'antennas' => { 1 => 'airGrid' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '2400',
},
@ -1152,8 +1114,6 @@ sub hardware_info
'supported' => '-2',
'maxpower' => '22',
'pwroffset' => '3',
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
'defaultant' => 3,
'usechains' => 1,
'rfband' => '3400',
},
@ -1163,8 +1123,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '19',
'pwroffset' => '9',
'antennas' => { 1 => 'airGrid' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '2400',
},
@ -1174,8 +1132,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '19',
'pwroffset' => '6',
'antennas' => { 1 => 'airGrid' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '5800ubntus',
},
@ -1185,8 +1141,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '22',
'pwroffset' => '1',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
'defaultant' => 3,
'usechains' => 1,
'rfband' => '5800ubntus',
},
@ -1196,8 +1150,6 @@ sub hardware_info
'supported' => '-1',
'maxpower' => '18',
'pwroffset' => '10',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
'defaultant' => 3,
'usechains' => 1,
'rfband' => '2400',
},
@ -1207,8 +1159,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '16',
'pwroffset' => '12',
'antennas' => { 1 => 'N Connector' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '2400',
},
@ -1218,8 +1168,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '19',
'pwroffset' => '6',
'antennas' => { 1 => 'N Connector' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '5800ubntus',
},
@ -1229,8 +1177,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '16',
'pwroffset' => '12',
'antennas' => { 1 => 'Antenna' },
'defaultant' => 1,
'usechains' => 0,
'rfband' => '2400',
},
@ -1240,8 +1186,6 @@ sub hardware_info
'supported' => '-1',
'maxpower' => '22',
'pwroffset' => '1',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
'defaultant' => 3,
'usechains' => 1,
'rfband' => '5500',
},
@ -1251,8 +1195,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '22',
'pwroffset' => '5',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
'defaultant' => 3,
'usechains' => 1,
'rfband' => '5800ubntus',
},
@ -1262,8 +1204,6 @@ sub hardware_info
'supported' => '-2',
'maxpower' => '22',
'pwroffset' => '4',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
'defaultant' => 3,
'usechains' => 1,
'rfband' => '5800ubntus',
},
@ -1273,8 +1213,6 @@ sub hardware_info
'supported' => '-2',
'maxpower' => '22',
'pwroffset' => '5',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
'defaultant' => 3,
'usechains' => 1,
'rfband' => '5800ubntus',
},
@ -1284,8 +1222,6 @@ sub hardware_info
'supported' => '1',
'maxpower' => '22',
'pwroffset' => '1',
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
'defaultant' => 3,
'usechains' => 1,
'rfband' => '5800ubntus',
},
@ -1315,43 +1251,6 @@ sub wifi_maxpower
}
}
sub wifi_validant
{
$boardinfo = hardware_info();
if ( exists $boardinfo->{'antennas'} ) {
return $boardinfo->{'antennas'};
} else
{
return { 0 => "Left", 1 => "Right", 2 => "Diversity" };
}
}
sub wifi_defaultant
{
$boardinfo = hardware_info();
if ( exists $boardinfo->{'defaultant'} ) {
return $boardinfo->{'defaultant'};
} else
{
#Most likely to catch all models. Some have 3 and start at 1, some start at 0, others have 1 at 1, etc
return 1;
}
}
sub wifi_useschains
{
$boardinfo = hardware_info();
if ( exists $boardinfo->{'usechains'} ) {
return $boardinfo->{'usechains'};
} else
{
return 1;
}
}
#Some systems have power offsets in them because of a secondary amplifier
#Because of this the chipset may report one power level but the amplifier
#has increased it to a higher level.

View File

@ -136,28 +136,12 @@ 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 = "";
}
# sanitize the active settings
$valid_ant = wifi_validant();
$wifi_txpower = wifi_maxpower() if not defined $wifi_txpower or $wifi_txpower > wifi_maxpower();
$wifi_txpower = 1 if $wifi_txpower < 1;
$wifi_rxant = wifi_defaultant() if not defined $wifi_rxant or not exists $valid_ant->{$wifi_rxant};
$wifi_txant = wifi_defaultant() if not defined $wifi_txant or not exists $valid_ant->{$wifi_txant};
$wifi_distance = 0 unless defined $wifi_distance;
$wifi_distance = 0 if $wifi_distance =~ /\D/;
@ -165,8 +149,6 @@ $wifi_distance = 0 if $wifi_distance =~ /\D/;
# so they get saved correctly
$parms{wifi_distance} = $wifi_distance;
$parms{wifi_txpower} = $wifi_txpower;
$parms{wifi_txant} = $wifi_txant;
$parms{wifi_rxant} = $wifi_rxant;
#
# apply the wifi settings
@ -176,16 +158,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 +595,7 @@ if($wifi_proto ne "disabled")
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 "<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 colspan=2><br>Antenna selection is now automatic<br><br></td></tr>";
print "<tr><td><nobr>Tx Power</nobr></td>\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
clicking the <strong>Apply</strong> button, but unless they are saved they
will revert to the previously saved values after a reboot.<br> <br>
The <strong>Rx Antenna</strong> and <strong>Tx Antenna</strong> settings are
named to match either the printed name on the antenna connector or in the
case of units that have a built in antenna the names are for units mounted
in its normal orientation.
The <strong>Rx Antenna</strong> and <strong>Tx Antenna</strong> settings have
been removed from current builds. The hardware handles antenna selection
automatically in the backend without need for configuration.
<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>
The <strong>Distance</strong> setting adjusts the packet retry timer