Merge pull request #2054 from freifunk-gluon/outdoor-mesh-enable

Enable 5GHz mesh interfaces when disabling outdoor mode, fix default status from site.conf
This commit is contained in:
Matthias Schiffer 2020-06-12 22:10:42 +02:00 committed by GitHub
commit a426312cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 1 deletions

View File

@ -21,6 +21,24 @@ return function(form, uci)
if data ~= outdoor_mode then if data ~= outdoor_mode then
uci:set('gluon', 'wireless', 'outdoor', data) uci:set('gluon', 'wireless', 'outdoor', data)
uci:save('gluon') uci:save('gluon')
if data == false then
local mesh_ifaces_5ghz = {}
uci:foreach('wireless', 'wifi-device', function(config)
if config.hwmode ~= '11a' and config.hwmode ~= '11na' then
return
end
local radio_name = config['.name']
local mesh_iface = 'mesh_' .. radio_name
table.insert(mesh_ifaces_5ghz, mesh_iface)
end)
for _, mesh_iface in ipairs(mesh_ifaces_5ghz) do
uci:delete('wireless', mesh_iface)
end
uci:save('wireless')
end
os.execute('/lib/gluon/upgrade/200-wireless') os.execute('/lib/gluon/upgrade/200-wireless')
end end
end end

View File

@ -85,7 +85,7 @@ local function is_disabled(name)
if uci:get('wireless', name) then if uci:get('wireless', name) then
return uci:get_bool('wireless', name, 'disabled') return uci:get_bool('wireless', name, 'disabled')
else else
return false return nil
end end
end end

View File

@ -1,5 +1,6 @@
local iwinfo = require 'iwinfo' local iwinfo = require 'iwinfo'
local uci = require("simple-uci").cursor() local uci = require("simple-uci").cursor()
local site = require 'gluon.site'
local wireless = require 'gluon.wireless' local wireless = require 'gluon.wireless'
@ -155,6 +156,9 @@ if has_5ghz_radio() then
for _, mesh_vif in ipairs(mesh_vifs_5ghz) do for _, mesh_vif in ipairs(mesh_vifs_5ghz) do
mesh_vif:depends(outdoor, false) mesh_vif:depends(outdoor, false)
if outdoor.default then
mesh_vif.default = not site.wifi5.mesh.disabled(false)
end
end end
function outdoor:write(data) function outdoor:write(data)