site: disallow usage of outdoor mode in case outdoor_chanlist is missing

The documentation states the outdoor mode is only enabled in case
outdoor_chanlist is defined in the sites wifi5 configurationsection:

 > If enabled, by setting ``wifi5.outdoor_chanlist``, a number of
 > devices that are commonly installed outdoors will have outdoor
 > mode automatically enabled during their initial setup

This currently does not hold true, as Outdoor mode is always activated
for these devices on first setup, even in case the site does not specify
an outdoor chanlist.

Furthermore, it also does not make sense to show the option neither in
setup-modes basic nor advences configuration view in case the site is
lacking an out door chanlist.

This patch will disable outdoor mode on new installs in case the outdoor
chanlist is missing. It will also not show the respective configuration
options in this case.

Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
David Bauer 2021-06-19 17:57:21 +02:00
parent 4f53b9848c
commit 963bcfd3ee
5 changed files with 19 additions and 4 deletions

View File

@ -12,6 +12,11 @@ return function(form, uci)
return return
end end
if not wireless.site_supports_outdoor_mode() then
-- Don't show in case the site does not support outdoor-mode
return
end
local pkg_i18n = i18n 'gluon-config-mode-outdoor' local pkg_i18n = i18n 'gluon-config-mode-outdoor'
local section = form:section(Section, nil, pkg_i18n.translate( local section = form:section(Section, nil, pkg_i18n.translate(

View File

@ -44,8 +44,10 @@ for _, config in ipairs({'wifi24', 'wifi5'}) do
120, 122, 124, 126, 128, 132, 134, 136, 138, 140, 142, 144, 120, 122, 124, 126, 128, 132, 134, 136, 138, 140, 142, 144,
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_one_of({config, 'outdoors'}, {true, false, 'preset'}, false) local outdoors = need_one_of({config, 'outdoors'}, {true, false, 'preset'}, false)
local outdoor_chanlist_required = (outdoors ~= false)
need_chanlist({config, 'outdoor_chanlist'}, channels, outdoor_chanlist_required)
end end
obsolete({config, 'supported_rates'}, '802.11b rates are disabled by default.') obsolete({config, 'supported_rates'}, '802.11b rates are disabled by default.')

View File

@ -13,11 +13,15 @@ end
local sysconfig = require 'gluon.sysconfig' local sysconfig = require 'gluon.sysconfig'
local platform = require 'gluon.platform' local platform = require 'gluon.platform'
local wireless = require 'gluon.wireless'
local config = site.wifi5.outdoors('preset') local config = site.wifi5.outdoors('preset')
local outdoor local outdoor
if sysconfig.gluon_version then if not wireless.site_supports_outdoor_mode() then
-- site does not support outdoor mode
outdoor = false
elseif sysconfig.gluon_version then
-- don't enable the outdoor mode after an upgrade -- don't enable the outdoor mode after an upgrade
outdoor = false outdoor = false
elseif config == 'preset' then elseif config == 'preset' then

View File

@ -100,4 +100,8 @@ function M.preserve_channels(uci)
return uci:get_first('gluon-core', 'wireless', 'preserve_channels') return uci:get_first('gluon-core', 'wireless', 'preserve_channels')
end end
function M.site_supports_outdoor_mode()
return site.wifi5.outdoor_chanlist() ~= nil
end
return M return M

View File

@ -142,7 +142,7 @@ uci:foreach('wireless', 'wifi-device', function(config)
end) end)
if has_5ghz_radio() and not wireless.preserve_channels(uci) then if has_5ghz_radio() and not wireless.preserve_channels(uci) and wireless.site_supports_outdoor_mode() then
local r = f:section(Section, translate("Outdoor Installation"), translate( local r = f:section(Section, translate("Outdoor Installation"), translate(
"Configuring the node for outdoor use tunes the 5 GHz radio to a frequency " "Configuring the node for outdoor use tunes the 5 GHz radio to a frequency "
.. "and transmission power that conforms with the local regulatory requirements. " .. "and transmission power that conforms with the local regulatory requirements. "