refactored radio hardware info

main
riley 1 year ago
parent 1b3930dd2d
commit 895d07f3c3

@ -31,39 +31,24 @@ function detect_Node()
end
function get_verbose_hw_info(iface)
local function get_verbose_hw_info(iface)
local type = iwinfo.type(iface)
if not type then
return "Generic"
end
if not type then return "Generic" end
local driver = iwinfo[type]
if not driver then
return "Driver not supported"
end
local hw_name = driver.hardware_name and driver.hardware_name(iface)
if not hw_name or hw_name == "" then
hw_name = "Unknown hardware"
end
if not driver then return "Driver not supported" end
local hw_modes = driver.hwmodelist and driver.hwmodelist(iface)
local hw_name = driver.hardware_name and driver.hardware_name(iface) or "Unknown hardware"
local hw_modes = driver.hwmodelist and driver.hwmodelist(iface) or {}
local supported_modes = {}
if hw_modes then
for mode, supported in pairs(hw_modes) do
if supported then
table.insert(supported_modes, mode)
end
supported_modes[#supported_modes + 1] = mode
end
end
if #supported_modes == 0 then
supported_modes_str = "No mode information"
else
supported_modes_str = table.concat(supported_modes, "/")
end
local verbose_info = hw_name .. " (" .. supported_modes_str .. ")"
return verbose_info
return hw_name .. " (" .. (#supported_modes > 0 and table.concat(supported_modes, "/") or "No mode information") .. ")"
end
local Nodes = luci.sys.exec("batctl n 2>/dev/null| tail +3 | wc -l")

Loading…
Cancel
Save