|
|
@ -3,6 +3,7 @@
|
|
|
|
local m,s,o
|
|
|
|
local m,s,o
|
|
|
|
local sys = require "luci.sys"
|
|
|
|
local sys = require "luci.sys"
|
|
|
|
local uci = require "luci.model.uci".cursor()
|
|
|
|
local uci = require "luci.model.uci".cursor()
|
|
|
|
|
|
|
|
local iwinfo = require "iwinfo"
|
|
|
|
|
|
|
|
|
|
|
|
m = Map("easymesh",
|
|
|
|
m = Map("easymesh",
|
|
|
|
translate("Easy Mesh WiFi Setup"),
|
|
|
|
translate("Easy Mesh WiFi Setup"),
|
|
|
@ -35,6 +36,26 @@ function detect_Node()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return data
|
|
|
|
return data
|
|
|
|
end
|
|
|
|
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 Nodes = luci.sys.exec("batctl n 2>/dev/null| tail +3 | wc -l")
|
|
|
|
local Node = detect_Node()
|
|
|
|
local Node = detect_Node()
|
|
|
|
v = m:section(Table, Node, "" ,"<b>" .. translate("Active node") .. "" .. Nodes .. "</b>")
|
|
|
|
v = m:section(Table, Node, "" ,"<b>" .. translate("Active node") .. "" .. Nodes .. "</b>")
|
|
|
@ -78,13 +99,17 @@ o:value("client", translate("Mesh Client"))
|
|
|
|
o.rmempty = false
|
|
|
|
o.rmempty = false
|
|
|
|
|
|
|
|
|
|
|
|
apRadio = s:option(ListValue, "apRadio", translate("Mesh Radio device"), translate("The WiFi radio device Mesh will use"))
|
|
|
|
apRadio = s:option(ListValue, "apRadio", translate("Mesh Radio device"), translate("The WiFi radio device Mesh will use"))
|
|
|
|
|
|
|
|
|
|
|
|
uci:foreach("wireless", "wifi-device",
|
|
|
|
uci:foreach("wireless", "wifi-device",
|
|
|
|
function(s)
|
|
|
|
function(s)
|
|
|
|
apRadio:value(s['.name'])
|
|
|
|
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)
|
|
|
|
end)
|
|
|
|
apRadio:value("all", translate("ALL"))
|
|
|
|
apRadio:value("all", translate("ALL"))
|
|
|
|
o.default = "radio0"
|
|
|
|
apRadio.default = "radio0"
|
|
|
|
o.rmempty = false
|
|
|
|
apRadio.rmempty = false
|
|
|
|
|
|
|
|
|
|
|
|
---- mesh
|
|
|
|
---- mesh
|
|
|
|
o = s:option(Value, "mesh_id", translate("Mesh ID"))
|
|
|
|
o = s:option(Value, "mesh_id", translate("Mesh ID"))
|
|
|
|