summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-01-19 21:37:01 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-01-19 21:37:01 +0000
commit32e908a51c27b58a23d955a964c68fd1fa07d3ad (patch)
tree2596e1bd658acac186cc9b71f5f813ebbc973cea
parent5841fce7c69677a582c4325ed0731d3a21382e2c (diff)
libs/sys: fix luci.sys.wifi.channels()
-rw-r--r--libs/sys/luasrc/sys.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua
index 817217b90..1cf8b9f18 100644
--- a/libs/sys/luasrc/sys.lua
+++ b/libs/sys/luasrc/sys.lua
@@ -722,10 +722,14 @@ end
-- @param iface Wireless interface (optional)
-- @return Table of available channels
function wifi.channels(iface)
- local t = iwinfo.type(iface or "")
+ local stat, iwinfo = pcall(require, "iwinfo")
local cns
- if iface and t and iwinfo[t] then
- cns = iwinfo[t].freqlist(iface)
+
+ if stat then
+ local t = iwinfo.type(iface or "")
+ if iface and t and iwinfo[t] then
+ cns = iwinfo[t].freqlist(iface)
+ end
end
if not cns or #cns == 0 then