Skip to content
Snippets Groups Projects
Unverified Commit c52089fc authored by David Bauer's avatar David Bauer Committed by Matthias Schiffer
Browse files

treewide: use radio band option to determine frequency band

The 'hwmode' setting has been replaced with 'band' in OpenWrt to add
support for newer bands outside of 2.4G and 5G. Adjust Gluon accordingly.

[Matthias Schiffer: rebased, extended commit message]
parent f6faa50a
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ return function(form, uci)
if data == false then
local mesh_ifaces_5ghz = {}
uci:foreach('wireless', 'wifi-device', function(config)
if config.hwmode ~= '11a' and config.hwmode ~= '11na' then
if config.band ~= '5g' then
return
end
......
......@@ -38,11 +38,11 @@ if not sysconfig.gluon_version then
if radio_band_count["band24"] <= radio_band_count["band5"] then
-- Assign radio to 2.4GHz band
radio_band_count["band24"] = radio_band_count["band24"] + 1
uci:set('wireless', radio_name, 'hwmode', '11g')
uci:set('wireless', radio_name, 'band', '2g')
else
-- Assign radio to 5GHz band
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)
......@@ -57,7 +57,7 @@ local function get_channel(radio, config)
if wireless.preserve_channels(uci) then
-- preserved channel always wins
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
channel = 'auto'
end
......@@ -66,7 +66,7 @@ local function get_channel(radio, config)
end
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')
if outdoor_htmode ~= nil then
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, 'basic_rate')
local hwmode = radio.hwmode
if hwmode == '11g' or hwmode == '11ng' then
local band = radio.band
if band == '2g' then
uci:set('wireless', radio_name, 'legacy_rates', false)
configure_mesh_wireless(radio, index, config)
elseif (hwmode == '11a' or hwmode == '11na') then
elseif (band == '5g') then
if is_outdoor() then
uci:set('wireless', radio_name, 'channels', config.outdoor_chanlist())
......
......@@ -112,11 +112,11 @@ function M.foreach_radio(uci, f)
end)
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)
elseif hwmode == '11a' or hwmode == '11na' then
elseif band == '5g' then
f(radio, index, site.wifi5)
end
end
......@@ -165,7 +165,7 @@ function M.device_uses_11a(uci)
local ret = false
uci:foreach('wireless', 'wifi-device', function(radio)
if radio.hwmode == '11a' or radio.hwmode == '11na' then
if radio.band == '5g' then
ret = true
return false
end
......
......@@ -44,9 +44,9 @@ uci:foreach('wireless', 'wifi-device', function(config)
local is_5ghz = false
local title
if config.hwmode == '11g' or config.hwmode == '11ng' then
if config.band == '2g' then
title = translate("2.4GHz WLAN")
elseif config.hwmode == '11a' or config.hwmode == '11na' then
elseif config.band == '5g' then
is_5ghz = true
title = translate("5GHz WLAN")
else
......@@ -155,9 +155,9 @@ if wireless.device_uses_11a(uci) and not wireless.preserve_channels(uci) then
uci:foreach('wireless', 'wifi-device', function(config)
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
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment