libs/sys: remove wifi.getiwconfig() and wifi.getiwscan()
This commit is contained in:
parent
a521cddcf8
commit
d1fd6e702e
1 changed files with 0 additions and 50 deletions
|
@ -836,56 +836,6 @@ function wifi.getiwinfo(ifname)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Get iwconfig output for all wireless devices.
|
|
||||||
-- @return Table of tables containing the iwconfing output for each wifi device
|
|
||||||
function wifi.getiwconfig()
|
|
||||||
local cnt = luci.util.exec("PATH=/sbin:/usr/sbin iwconfig 2>/dev/null")
|
|
||||||
local iwc = {}
|
|
||||||
|
|
||||||
for i, l in pairs(luci.util.split(luci.util.trim(cnt), "\n\n")) do
|
|
||||||
local k = l:match("^(.-) ")
|
|
||||||
l = l:gsub("^(.-) +", "", 1)
|
|
||||||
if k then
|
|
||||||
local entry, flags = _parse_mixed_record(l)
|
|
||||||
if entry then
|
|
||||||
entry.flags = flags
|
|
||||||
end
|
|
||||||
iwc[k] = entry
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return iwc
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Get iwlist scan output from all wireless devices.
|
|
||||||
-- @return Table of tables contaiing all scan results
|
|
||||||
function wifi.iwscan(iface)
|
|
||||||
local siface = iface or ""
|
|
||||||
local cnt = luci.util.exec("iwlist "..siface.." scan 2>/dev/null")
|
|
||||||
local iws = {}
|
|
||||||
|
|
||||||
for i, l in pairs(luci.util.split(luci.util.trim(cnt), "\n\n")) do
|
|
||||||
local k = l:match("^(.-) ")
|
|
||||||
l = l:gsub("^[^\n]+", "", 1)
|
|
||||||
l = luci.util.trim(l)
|
|
||||||
if k then
|
|
||||||
iws[k] = {}
|
|
||||||
for j, c in pairs(luci.util.split(l, "\n Cell")) do
|
|
||||||
c = c:gsub("^(.-)- ", "", 1)
|
|
||||||
c = luci.util.split(c, "\n", 7)
|
|
||||||
c = table.concat(c, "\n", 1)
|
|
||||||
local entry, flags = _parse_mixed_record(c)
|
|
||||||
if entry then
|
|
||||||
entry.flags = flags
|
|
||||||
end
|
|
||||||
table.insert(iws[k], entry)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return iface and (iws[iface] or {}) or iws
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Get available channels from given wireless iface.
|
--- Get available channels from given wireless iface.
|
||||||
-- @param iface Wireless interface (optional)
|
-- @param iface Wireless interface (optional)
|
||||||
-- @return Table of available channels
|
-- @return Table of available channels
|
||||||
|
|
Loading…
Reference in a new issue