mirror of https://github.com/aredn/aredn.git
Initial code for 5GHZ (and other band) devices.
Includes band/channel mapping Code to set default RF channel on first boot Add many 5ghz Ubiquiti devices in a testing phase including: NanoBeam M5 (Intl), NanoBridge M5, AirGrid M5 HP, AirGrid M5, NanoStation M5, NanoStation Loco M5, Bullet M5, Rocket M5 see BBHN->ticket:29
This commit is contained in:
parent
f6d81b25c2
commit
3b215c40c0
|
@ -1,7 +1,6 @@
|
|||
config wifi-device radio0
|
||||
option type mac80211
|
||||
option phy phy0
|
||||
option channel 1
|
||||
option distance 0
|
||||
|
||||
config wifi-iface
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
uci set wireless.radio0.channel=`perl -I/www/cgi-bin -e 'use channelmaps; $channels = rf_channels_list(); foreach $channelnumber (sort {$a <=> $b} keys %{$channels} ) { print $channelnumber; exit 0;}'`
|
||||
uci -q commit
|
|
@ -0,0 +1,139 @@
|
|||
|
||||
use perlfunc;
|
||||
|
||||
#############################
|
||||
|
||||
#
|
||||
# @returns all channels, or specific band lis
|
||||
sub rf_channel_map
|
||||
{
|
||||
%channellist = (
|
||||
'2400' => {
|
||||
1 => "1 (2412)",
|
||||
2 => "2 (2417)",
|
||||
3 => "3 (2422)",
|
||||
4 => "4 (2427)",
|
||||
5 => "5 (2432)",
|
||||
6 => "6 (2437)",
|
||||
7 => "7 (2442)",
|
||||
8 => "8 (2447)",
|
||||
9 => "9 (2452)",
|
||||
10 => "10 (2457)",
|
||||
11 => "11 (2462)",
|
||||
},
|
||||
'5500' => {
|
||||
37 => "36 (5190)",
|
||||
40 => "40 (5200)",
|
||||
44 => "44 (5220)",
|
||||
48 => "48 (5240)",
|
||||
52 => "52 (5260)",
|
||||
56 => "56 (5280)",
|
||||
60 => "60 (5300)",
|
||||
64 => "64 (5320)",
|
||||
100 => "100 (5500)",
|
||||
104 => "104 (5520)",
|
||||
108 => "108 (5540)",
|
||||
112 => "112 (5560)",
|
||||
116 => "116 (5580)",
|
||||
120 => "120 (5600)",
|
||||
124 => "124 (5620)",
|
||||
128 => "128 (5640)",
|
||||
132 => "132 (5660)",
|
||||
136 => "136 (5680)",
|
||||
140 => "140 (5700)",
|
||||
149 => "149 (5745)",
|
||||
153 => "153 (5765)",
|
||||
157 => "157 (5785)",
|
||||
161 => "161 (5805)",
|
||||
165 => "165 (5825)",
|
||||
},
|
||||
# 5800 UBNT US Band
|
||||
# Limiting to US speced channels until the hardware can be tested
|
||||
# lower into the spectrum.
|
||||
'5800ubntus' => {
|
||||
149 => "149 (5745)",
|
||||
153 => "153 (5765)",
|
||||
157 => "157 (5785)",
|
||||
161 => "161 (5805)",
|
||||
165 => "165 (5825)",
|
||||
},
|
||||
);
|
||||
|
||||
my($reqband) = @_;
|
||||
|
||||
if ( defined($reqband) ){
|
||||
if ( exists($channellist{$reqband}) ){
|
||||
return $channellist{$reqband};
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return $channellist;
|
||||
}
|
||||
}
|
||||
|
||||
sub is_channel_valid
|
||||
{
|
||||
my ($channel) = @_;
|
||||
|
||||
if ( !defined($channel) ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
$boardinfo=hardware_info();
|
||||
#We know about the band so lets use it
|
||||
if ( exists($boardinfo->{'rfband'}))
|
||||
{
|
||||
$validchannels=rf_channel_map($boardinfo->{'rfband'});
|
||||
|
||||
if ( exists($validchannels->{$channel}) )
|
||||
{
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
# We don't have the device band in the data file so lets fall back to checking manually
|
||||
else {
|
||||
my $channelok=0;
|
||||
foreach (`iwlist wlan0 channel`)
|
||||
{
|
||||
next unless /Channel $channel/;
|
||||
$channelok=1;
|
||||
}
|
||||
return $channelok;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub rf_channels_list
|
||||
{
|
||||
|
||||
$boardinfo=hardware_info();
|
||||
#We know about the band so lets use it
|
||||
if ( exists($boardinfo->{'rfband'}))
|
||||
{
|
||||
if (rf_channel_map($boardinfo->{'rfband'}) != -1 )
|
||||
{
|
||||
return rf_channel_map($boardinfo->{'rfband'});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
my %channels = ();
|
||||
foreach (`iwlist wlan0 channel` )
|
||||
{
|
||||
next unless /([0-9]+) : ([0-9]+.[0-9]+)/;
|
||||
$channels->{$1} = "$2 GHZ" ;
|
||||
}
|
||||
return $channels;
|
||||
}
|
||||
}
|
||||
|
||||
#weird uhttpd/busybox error requires a 1 at the end of this file
|
||||
1
|
||||
|
|
@ -913,6 +913,17 @@ sub hardware_info
|
|||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
},
|
||||
'0xe1b5' => {
|
||||
'name' => 'Rocket M5',
|
||||
'comment' => 'Rocket M5 in testing',
|
||||
'supported' => '-2',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '5',
|
||||
'antennas' => { 1 => "Chain0", 2 => "Chain1", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
'0xe202' => {
|
||||
'name' => 'Bullet M2 HP',
|
||||
'comment' => '',
|
||||
|
@ -923,6 +934,28 @@ sub hardware_info
|
|||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
},
|
||||
'0xe205' => {
|
||||
'name' => 'Bullet M5',
|
||||
'comment' => 'Bullet M5 In testing.',
|
||||
'supported' => '-2',
|
||||
'maxpower' => '19',
|
||||
'pwroffset' => '6',
|
||||
'antennas' => { 1 => 'N Connector' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
'0xe215' => {
|
||||
'name' => 'airGrid M5',
|
||||
'comment' => 'airGrid M5 in testing',
|
||||
'supported' => '-2',
|
||||
'maxpower' => '19',
|
||||
'pwroffset' => '1',
|
||||
'antennas' => { 1 => 'airGrid' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
'0xe243' => {
|
||||
'name' => 'NannoBridge M3',
|
||||
'comment' => 'Not Tested',
|
||||
|
@ -943,6 +976,61 @@ sub hardware_info
|
|||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
},
|
||||
'0xe255' => {
|
||||
'name' => 'airGrid M5 HP',
|
||||
'comment' => 'airGrid M5 HP in testing',
|
||||
'supported' => '-2',
|
||||
'maxpower' => '19',
|
||||
'pwroffset' => '6',
|
||||
'antennas' => { 1 => 'airGrid' },
|
||||
'defaultant' => 1,
|
||||
'usechains' => 0,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
'0xe2b5' => {
|
||||
'name' => 'NannoBridge M5',
|
||||
'comment' => 'NanoBridge M5 in testing',
|
||||
'supported' => '-2',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '1',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
'0xe4e5' => {
|
||||
'name' => 'NannoBeam M5 International',
|
||||
'comment' => 'NanoBeam M5 International in testing',
|
||||
'supported' => '-2',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '1',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity"},
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5500',
|
||||
},
|
||||
'0xe805' => {
|
||||
'name' => 'NanoStation M5',
|
||||
'comment' => 'NanoStation M5 in testing',
|
||||
'supported' => '-2',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '5',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
'0xe8a5' => {
|
||||
'name' => 'NanoStation Loco M5',
|
||||
'comment' => 'NanoStation Loco M5 in testing',
|
||||
'supported' => '-2',
|
||||
'maxpower' => '22',
|
||||
'pwroffset' => '1',
|
||||
'antennas' => { 1 => "Horizontal", 2 => "Vertical", 3 => "Diversity" },
|
||||
'defaultant' => 3,
|
||||
'usechains' => 1,
|
||||
'rfband' => '5800ubntus',
|
||||
},
|
||||
);
|
||||
|
||||
$boardid = hardware_boardid();
|
||||
|
|
|
@ -4,6 +4,7 @@ $debug = 0;
|
|||
|
||||
BEGIN {push @INC, '/www/cgi-bin'};
|
||||
use perlfunc;
|
||||
use channelmaps;
|
||||
|
||||
#
|
||||
# load the config parms
|
||||
|
@ -166,7 +167,12 @@ if($parms{button_save})
|
|||
}
|
||||
|
||||
push (@errors, "invalid WiFi SSID") unless length $wifi_ssid <= 32;
|
||||
push (@errors, "invalid WiFi channel") if $wifi_channel < 1 or $wifi_channel > 11;
|
||||
|
||||
if ( is_channel_valid($wifi_channel) != 1 )
|
||||
{
|
||||
push (@errors, "invalid WiFi channel")
|
||||
}
|
||||
|
||||
push (@errors, "invalid WiFi distance") if $wifi_distance < 0 or $wifi_distance =~ /\D/;
|
||||
|
||||
if($lan_proto eq "static")
|
||||
|
@ -486,8 +492,12 @@ if($wifi_proto ne "disabled")
|
|||
{
|
||||
print "<tr><td>Channel</td>\n";
|
||||
print "<td><select name=wifi_channel>\n";
|
||||
for($i = 1; $i <= 11; ++$i) { selopt($i, $i, $wifi_channel) }
|
||||
print "</select></td></tr>\n";
|
||||
my $rfchannels=rf_channels_list();
|
||||
foreach $channelnumber (sort {$a <=> $b} keys %{$rfchannels} )
|
||||
{
|
||||
selopt($rfchannels->{$channelnumber}, $channelnumber, $wifi_channel);
|
||||
}
|
||||
print "</select></td></tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue