gluon-core: allow presetting the outdoor mode for new installations
This commit is contained in:
parent
423aafbd29
commit
e20d5b0a3e
@ -172,6 +172,10 @@ wifi5 \: optional
|
||||
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
|
||||
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 = {
|
||||
|
@ -44,6 +44,7 @@ for _, config in ipairs({'wifi24', 'wifi5'}) do
|
||||
149, 151, 153, 155, 157, 159, 161, 165, 169, 173 }
|
||||
need_one_of({config, 'channel'}, channels)
|
||||
need_chanlist({config, 'outdoor_chanlist'}, channels, false)
|
||||
need_one_of({config, 'outdoors'}, {true, false, 'preset'}, false)
|
||||
end
|
||||
|
||||
obsolete({config, 'supported_rates'}, '802.11b rates are disabled by default.')
|
||||
|
35
package/gluon-core/luasrc/lib/gluon/upgrade/180-outdoors
Executable file
35
package/gluon-core/luasrc/lib/gluon/upgrade/180-outdoors
Executable file
@ -0,0 +1,35 @@
|
||||
#!/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)
|
||||
|
||||
return true
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user