Skip to content
Snippets Groups Projects
Commit e20d5b0a authored by Martin Weinelt's avatar Martin Weinelt
Browse files

gluon-core: allow presetting the outdoor mode for new installations

parent 423aafbd
No related branches found
No related tags found
No related merge requests found
...@@ -172,6 +172,10 @@ wifi5 \: optional ...@@ -172,6 +172,10 @@ wifi5 \: optional
When set this offers the outdoor mode flag for 5 GHz radios in the config mode which When set this offers the outdoor mode flag for 5 GHz radios in the config mode which
reconfigures the AP to select its channel from outdoor chanlist, while respecting reconfigures the AP to select its channel from outdoor chanlist, while respecting
regulatory specifications, and disables mesh on that radio. regulatory specifications, and disables mesh on that radio.
The ``outdoors`` option in turn allows to configure when outdoor mode will be enabled.
When set to ``true`` all 5 GHz radios will use outdoor channels, while on ``false``
the outdoor mode will be completely disabled. The default setting is ``'preset'``,
which will enable outdoor mode automatically on outdoor-capable devices.
:: ::
wifi5 = { wifi5 = {
......
...@@ -44,6 +44,7 @@ for _, config in ipairs({'wifi24', 'wifi5'}) do ...@@ -44,6 +44,7 @@ for _, config in ipairs({'wifi24', 'wifi5'}) do
149, 151, 153, 155, 157, 159, 161, 165, 169, 173 } 149, 151, 153, 155, 157, 159, 161, 165, 169, 173 }
need_one_of({config, 'channel'}, channels) need_one_of({config, 'channel'}, channels)
need_chanlist({config, 'outdoor_chanlist'}, channels, false) need_chanlist({config, 'outdoor_chanlist'}, channels, false)
need_one_of({config, 'outdoors'}, {true, false, 'preset'}, false)
end end
obsolete({config, 'supported_rates'}, '802.11b rates are disabled by default.') obsolete({config, 'supported_rates'}, '802.11b rates are disabled by default.')
......
#!/usr/bin/lua
-- This script needs to be sorted before 200-wireless as it affects
-- wireless channel selection and wireless mesh configuration.
local uci = require('simple-uci').cursor()
local site = require 'gluon.site'
if uci:get('gluon', 'wireless', 'outdoor') ~= nil then
-- don't overwrite existing configuration
os.exit(0)
end
local sysconfig = require 'gluon.sysconfig'
local platform_info = require 'platform_info'
local config = site.wifi5.outdoor_preset('preset')
local outdoor = false
if sysconfig.gluon_version then
-- don't enable the outdoor mode after an upgrade
outdoor = false
elseif config == 'preset' then
-- enable outdoor mode through presets on new installs
outdoor = platform_info.is_outdoor_device()
else
-- enable/disable outdoor mode unconditionally on new installs
outdoor = config
end
uci:section('gluon', 'wireless', 'wireless', {
outdoor = outdoor
})
uci:save('gluon')
...@@ -27,3 +27,23 @@ function match(target, subtarget, boards) ...@@ -27,3 +27,23 @@ function match(target, subtarget, boards)
return true return true
end end
function is_outdoor_device()
if match('ar71xx', 'generic', {
'cpe510-520-v1',
'ubnt-nano-m',
'ubnt-nano-m-xw',
}) then
return true
elseif match('ar71xx', 'generic', {'unifiac-lite'}) and
get_model() == 'Ubiquiti UniFi-AC-MESH' then
return true
elseif match('ar71xx', 'generic', {'unifiac-pro'}) and
get_model() == 'Ubiquiti UniFi-AC-MESH-PRO' then
return true
end
return false
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment