diff options
author | Jo-Philipp Wich <jo@mein.io> | 2017-01-25 23:37:40 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2017-01-25 23:37:40 +0100 |
commit | b5db545077b23042261a03e9145124b35d83bd6c (patch) | |
tree | e3a582632b464533b6a5d5ca087166f2c6d2e19c | |
parent | dbbb3c749770e554676a16c680c6686ca34daf04 (diff) |
luci-mod-admin-full: reload wifi settings page after changing countey code
Reloading the page ensures that the allowed tx power values and channel select
lists are properly populated with the new effective values.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua index 91d092978c..afe0d662b7 100644 --- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -42,6 +42,9 @@ end -- wireless toggle was requested, commit and reload page function m.parse(map) + local new_cc = m:formvalue("cbid.wireless.%s.country" % wdev:name()) + local old_cc = m:get(wdev:name(), "country") + if m:formvalue("cbid.wireless.%s.__toggle" % wdev:name()) then if wdev:get("disabled") == "1" or wnet:get("disabled") == "1" then wnet:set("disabled", nil) @@ -56,7 +59,14 @@ function m.parse(map) luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless", arg[1])) return end + Map.parse(map) + + if m:get(wdev:name(), "type") == "mac80211" and new_cc and new_cc ~= old_cc then + luci.sys.call("iw reg set %q" % new_cc) + luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless", arg[1])) + return + end end m.title = luci.util.pcdata(wnet:get_i18n()) |