treewide: use radio band option to determine frequency
Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
parent
bd760ab813
commit
e838feaba2
@ -31,7 +31,7 @@ return function(form, uci)
|
|||||||
if data == false then
|
if data == false then
|
||||||
local mesh_ifaces_5ghz = {}
|
local mesh_ifaces_5ghz = {}
|
||||||
uci:foreach('wireless', 'wifi-device', function(config)
|
uci:foreach('wireless', 'wifi-device', function(config)
|
||||||
if config.hwmode ~= '11a' and config.hwmode ~= '11na' then
|
if config.band ~= '5g' then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ if not sysconfig.gluon_version then
|
|||||||
if radio_band_count["band24"] <= radio_band_count["band5"] then
|
if radio_band_count["band24"] <= radio_band_count["band5"] then
|
||||||
-- Assign radio to 2.4GHz band
|
-- Assign radio to 2.4GHz band
|
||||||
radio_band_count["band24"] = radio_band_count["band24"] + 1
|
radio_band_count["band24"] = radio_band_count["band24"] + 1
|
||||||
uci:set('wireless', radio_name, 'hwmode', '11g')
|
uci:set('wireless', radio_name, 'band', '2g')
|
||||||
else
|
else
|
||||||
-- Assign radio to 5GHz band
|
-- Assign radio to 5GHz band
|
||||||
radio_band_count["band5"] = radio_band_count["band5"] + 1
|
radio_band_count["band5"] = radio_band_count["band5"] + 1
|
||||||
uci:set('wireless', radio_name, 'hwmode', '11a')
|
uci:set('wireless', radio_name, 'band', '5g')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@ -57,7 +57,7 @@ local function get_channel(radio, config)
|
|||||||
if wireless.preserve_channels(uci) then
|
if wireless.preserve_channels(uci) then
|
||||||
-- preserved channel always wins
|
-- preserved channel always wins
|
||||||
channel = radio.channel
|
channel = radio.channel
|
||||||
elseif (radio.hwmode == '11a' or radio.hwmode == '11na') and is_outdoor() then
|
elseif radio.band == '5g' and is_outdoor() then
|
||||||
-- actual channel will be picked and probed from chanlist
|
-- actual channel will be picked and probed from chanlist
|
||||||
channel = 'auto'
|
channel = 'auto'
|
||||||
end
|
end
|
||||||
@ -66,7 +66,7 @@ local function get_channel(radio, config)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function get_htmode(radio)
|
local function get_htmode(radio)
|
||||||
if (radio.hwmode == '11a' or radio.hwmode == '11na') and is_outdoor() then
|
if radio.band == '5g' and is_outdoor() then
|
||||||
local outdoor_htmode = uci:get('gluon', 'wireless', 'outdoor_' .. radio['.name'] .. '_htmode')
|
local outdoor_htmode = uci:get('gluon', 'wireless', 'outdoor_' .. radio['.name'] .. '_htmode')
|
||||||
if outdoor_htmode ~= nil then
|
if outdoor_htmode ~= nil then
|
||||||
return outdoor_htmode
|
return outdoor_htmode
|
||||||
@ -207,11 +207,11 @@ wireless.foreach_radio(uci, function(radio, index, config)
|
|||||||
uci:delete('wireless', radio_name, 'supported_rates')
|
uci:delete('wireless', radio_name, 'supported_rates')
|
||||||
uci:delete('wireless', radio_name, 'basic_rate')
|
uci:delete('wireless', radio_name, 'basic_rate')
|
||||||
|
|
||||||
local hwmode = radio.hwmode
|
local band = radio.band
|
||||||
if hwmode == '11g' or hwmode == '11ng' then
|
if band == '1g' then
|
||||||
uci:set('wireless', radio_name, 'legacy_rates', false)
|
uci:set('wireless', radio_name, 'legacy_rates', false)
|
||||||
configure_mesh_wireless(radio, index, config)
|
configure_mesh_wireless(radio, index, config)
|
||||||
elseif (hwmode == '11a' or hwmode == '11na') then
|
elseif (band == '5g') then
|
||||||
if is_outdoor() then
|
if is_outdoor() then
|
||||||
uci:set('wireless', radio_name, 'channels', config.outdoor_chanlist())
|
uci:set('wireless', radio_name, 'channels', config.outdoor_chanlist())
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ function M.device_uses_11a(uci)
|
|||||||
local ret = false
|
local ret = false
|
||||||
|
|
||||||
uci:foreach('wireless', 'wifi-device', function(radio)
|
uci:foreach('wireless', 'wifi-device', function(radio)
|
||||||
if radio.hwmode == '11a' or radio.hwmode == '11na' then
|
if radio.band == '5g' then
|
||||||
ret = true
|
ret = true
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -86,11 +86,11 @@ function M.foreach_radio(uci, f)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
for index, radio in ipairs(radios) do
|
for index, radio in ipairs(radios) do
|
||||||
local hwmode = radio.hwmode
|
local band = radio.band
|
||||||
|
|
||||||
if hwmode == '11g' or hwmode == '11ng' then
|
if band == '2g' then
|
||||||
f(radio, index, site.wifi24)
|
f(radio, index, site.wifi24)
|
||||||
elseif hwmode == '11a' or hwmode == '11na' then
|
elseif band == '5g' then
|
||||||
f(radio, index, site.wifi5)
|
f(radio, index, site.wifi5)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -28,9 +28,9 @@ local function has_5ghz_radio()
|
|||||||
local result = false
|
local result = false
|
||||||
uci:foreach('wireless', 'wifi-device', function(config)
|
uci:foreach('wireless', 'wifi-device', function(config)
|
||||||
local radio = config['.name']
|
local radio = config['.name']
|
||||||
local hwmode = uci:get('wireless', radio, 'hwmode')
|
local band = uci:get('wireless', radio, 'band')
|
||||||
|
|
||||||
result = result or (hwmode == '11a' or hwmode == '11na')
|
result = result or (band == '5g')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
@ -56,9 +56,9 @@ uci:foreach('wireless', 'wifi-device', function(config)
|
|||||||
|
|
||||||
local is_5ghz = false
|
local is_5ghz = false
|
||||||
local title
|
local title
|
||||||
if config.hwmode == '11g' or config.hwmode == '11ng' then
|
if config.band == '2g' then
|
||||||
title = translate("2.4GHz WLAN")
|
title = translate("2.4GHz WLAN")
|
||||||
elseif config.hwmode == '11a' or config.hwmode == '11na' then
|
elseif config.band == '5g' then
|
||||||
is_5ghz = true
|
is_5ghz = true
|
||||||
title = translate("5GHz WLAN")
|
title = translate("5GHz WLAN")
|
||||||
else
|
else
|
||||||
@ -167,9 +167,9 @@ if has_5ghz_radio() and not wireless.preserve_channels(uci) then
|
|||||||
|
|
||||||
uci:foreach('wireless', 'wifi-device', function(config)
|
uci:foreach('wireless', 'wifi-device', function(config)
|
||||||
local radio = config['.name']
|
local radio = config['.name']
|
||||||
local hwmode = uci:get('wireless', radio, 'hwmode')
|
local band = uci:get('wireless', radio, 'band')
|
||||||
|
|
||||||
if hwmode ~= '11a' and hwmode ~= '11na' then
|
if band ~= '5g' then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user