Trying out new radio names in dropdown

main
riley 1 year ago
parent d8b557d107
commit dc28c57646

@ -3,6 +3,7 @@
local m,s,o
local sys = require "luci.sys"
local uci = require "luci.model.uci".cursor()
local iwinfo = require "iwinfo"
m = Map("easymesh",
translate("Easy Mesh WiFi Setup"),
@ -35,6 +36,26 @@ function detect_Node()
end
return data
end
local function get_hw_modes(iface)
local type = iwinfo.type(iface)
if not type then
return "unknown"
end
local hw_modes = iwinfo.hwmodelist(type)
if not hw_modes then
return "unknown"
end
local modes = {}
for mode, _ in pairs(hw_modes) do
table.insert(modes, mode)
end
return table.concat(modes, "/")
end
local Nodes = luci.sys.exec("batctl n 2>/dev/null| tail +3 | wc -l")
local Node = detect_Node()
v = m:section(Table, Node, "" ,"<b>" .. translate("Active node") .. "" .. Nodes .. "</b>")
@ -78,13 +99,17 @@ o:value("client", translate("Mesh Client"))
o.rmempty = false
apRadio = s:option(ListValue, "apRadio", translate("Mesh Radio device"), translate("The WiFi radio device Mesh will use"))
uci:foreach("wireless", "wifi-device",
function(s)
apRadio:value(s['.name'])
end)
function(s)
local iface = s['.name']
local hw_modes = get_hw_modes(iface)
local desc = string.format("%s (%s)", iface, hw_modes)
apRadio:value(iface, desc) -- Display radio interface with its hardware modes
end)
apRadio:value("all", translate("ALL"))
o.default = "radio0"
o.rmempty = false
apRadio.default = "radio0"
apRadio.rmempty = false
---- mesh
o = s:option(Value, "mesh_id", translate("Mesh ID"))

Loading…
Cancel
Save