- Add support for hostap driver
[project/luci.git] / libs / sys / luasrc / sys.lua
index d606248..9910ed3 100644 (file)
@@ -691,17 +691,18 @@ function wifi.channels(iface)
        local fd = io.popen(cmd)
        if fd then
                local ln, c, f
-               repeat
-                       ln = fd:read("*l") or ""
+               while true do
+                       ln = fd:read("*l")
+                       if not ln then break end
                        c, f = ln:match("Channel (%d+) : (%d+%.%d+) GHz")
                        if c and f then
                                cns[tonumber(c)] = tonumber(f)
                        end
-               until not ( #ln > 0 )
+               end
                fd:close()
        end
 
-       if #cns == 0 then
+       if not ((pairs(cns))(cns)) then
                cns = {
                        2.412, 2.417, 2.422, 2.427, 2.432, 2.437,
                        2.442, 2.447, 2.452, 2.457, 2.462