Huuuuuuuuuuuge rewrite of the Wireless Configuration
[project/luci.git] / libs / sys / luasrc / sys.lua
index 970dcff..d0dc5ac 100644 (file)
@@ -432,8 +432,9 @@ end
 
 --- Get iwlist scan output from all wireless devices.
 -- @return     Table of tables contaiing all scan results
-function wifi.iwscan()
-       local cnt = luci.util.exec("iwlist scan 2>/dev/null")
+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
@@ -451,7 +452,7 @@ function wifi.iwscan()
                end
        end
 
-       return iws
+       return iface and (iws[iface] or {}) or iws
 end