diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-10-26 22:12:50 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-10-26 22:12:50 +0000 |
commit | c3e8976605175dc873653d9fd3d1ab5705593f00 (patch) | |
tree | c61e9e49ff37def4ae8f77548830b8438f924736 /modules | |
parent | 017d24c7241ba2393498b3ceb637cb0883c9e114 (diff) |
modules/admin-full: lock channel section in ap wifi config if there is a station on the same radio
Diffstat (limited to 'modules')
-rw-r--r-- | modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua index f5d6cf476..dfca7d27d 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -114,14 +114,30 @@ local htcaps = wdev:get("ht_capab") and true or false -- NanoFoo local nsantenna = wdev:get("antenna") -ch = s:taboption("general", Value, "channel", translate("Channel")) -ch:value("auto", translate("auto")) -for _, f in ipairs(iw and iw.freqlist or luci.sys.wifi.channels()) do - if not f.restricted then - ch:value(f.channel, "%i (%.3f GHz)" %{ f.channel, f.mhz / 1000 }) +-- Check whether there is a client interface on the same radio, +-- if yes, lock the channel choice as the station will dicatate the freq +local has_sta = nil +local _, net +for _, net in ipairs(wdev:get_wifinets()) do + if net:mode() == "sta" and net:id() ~= wnet:id() then + has_sta = net + break end end +if has_sta then + ch = s:taboption("general", DummyValue, "choice", translate("Channel")) + ch.value = translatef("Locked to channel %d used by %s", + has_sta:channel(), has_sta:shortname()) +else + ch = s:taboption("general", Value, "channel", translate("Channel")) + ch:value("auto", translate("auto")) + for _, f in ipairs(iw and iw.freqlist or luci.sys.wifi.channels()) do + if not f.restricted then + ch:value(f.channel, "%i (%.3f GHz)" %{ f.channel, f.mhz / 1000 }) + end + end +end ------------------- MAC80211 Device ------------------ |