From f4fe58cfd7eaaeab11a7eea89e9faeffd1e7c353 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 7 May 2020 00:19:33 +0200 Subject: [PATCH] gluon-core: ignore is_outdoor_device() value on devices without 5GHz radio --- .../lib/gluon/config-mode/wizard/0250-outdoor.lua | 2 +- .../luasrc/lib/gluon/upgrade/180-outdoors | 2 +- .../luasrc/usr/lib/lua/gluon/platform.lua | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua b/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua index a4753f5a..c36c1f8f 100644 --- a/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua +++ b/package/gluon-config-mode-outdoor/luasrc/lib/gluon/config-mode/wizard/0250-outdoor.lua @@ -1,7 +1,7 @@ return function(form, uci) local platform = require 'gluon.platform' - if not platform.is_outdoor_device() then + if not (platform.is_outdoor_device() and platform.device_uses_11a(uci)) then -- only visible on wizard for outdoor devices return end diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/180-outdoors b/package/gluon-core/luasrc/lib/gluon/upgrade/180-outdoors index f9278e1f..5c5a92e2 100755 --- a/package/gluon-core/luasrc/lib/gluon/upgrade/180-outdoors +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/180-outdoors @@ -22,7 +22,7 @@ if sysconfig.gluon_version then outdoor = false elseif config == 'preset' then -- enable outdoor mode through presets on new installs - outdoor = platform.is_outdoor_device() + outdoor = platform.is_outdoor_device() and platform.device_uses_11a(uci) else -- enable/disable outdoor mode unconditionally on new installs outdoor = config diff --git a/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua b/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua index 8ffcd1cd..1b20d0fd 100644 --- a/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua +++ b/package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua @@ -85,4 +85,17 @@ function M.device_supports_mfp(uci) return supports_mfp end +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 + ret = true + return false + end + end) + + return ret +end + return M