X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-mod-admin-full%2Fluasrc%2Fmodel%2Fcbi%2Fadmin_network%2Fwifi.lua;h=afe0d662b7fc08fab6ee86a2f0b1266d077a6ff3;hp=09763e8f14523ba96842d3a3c72521b1521fc27f;hb=fecf6e1d11d466efa7b1bbf05633931a3081517e;hpb=91511033564929af41fa1f57bccde7fbcb7f5620 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 09763e8f1..afe0d662b 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()) @@ -94,7 +104,7 @@ local function txpower_current(pwr, list) end end end - return (list[#list] and list[#list].driver_dbm) or pwr or 0 + return pwr or "" end local iw = luci.sys.wifi.getiwinfo(arg[1]) @@ -191,7 +201,7 @@ end ------------------- MAC80211 Device ------------------ if hwtype == "mac80211" then - if #tx_power_list > 1 then + if #tx_power_list > 0 then tp = s:taboption("general", ListValue, "txpower", translate("Transmit Power"), "dBm") tp.rmempty = true @@ -200,6 +210,7 @@ if hwtype == "mac80211" then return txpower_current(Value.cfgvalue(...), tx_power_list) end + tp:value("", translate("auto")) for _, p in ipairs(tx_power_list) do tp:value(p.driver_dbm, "%i dBm (%i mW)" %{ p.display_dbm, p.display_mw }) @@ -251,6 +262,7 @@ if hwtype == "atheros" then return txpower_current(Value.cfgvalue(...), tx_power_list) end + tp:value("", translate("auto")) for _, p in ipairs(tx_power_list) do tp:value(p.driver_dbm, "%i dBm (%i mW)" %{ p.display_dbm, p.display_mw }) @@ -308,11 +320,42 @@ if hwtype == "broadcom" then return txpower_current(Value.cfgvalue(...), tx_power_list) end + tp:value("", translate("auto")) for _, p in ipairs(tx_power_list) do tp:value(p.driver_dbm, "%i dBm (%i mW)" %{ p.display_dbm, p.display_mw }) end + mode = s:taboption("advanced", ListValue, "hwmode", translate("Band")) + if hw_modes.b then + mode:value("11b", "2.4GHz (802.11b)") + if hw_modes.g then + mode:value("11bg", "2.4GHz (802.11b+g)") + end + end + if hw_modes.g then + mode:value("11g", "2.4GHz (802.11g)") + mode:value("11gst", "2.4GHz (802.11g + Turbo)") + mode:value("11lrs", "2.4GHz (802.11g Limited Rate Support)") + end + if hw_modes.a then mode:value("11a", "5GHz (802.11a)") end + if hw_modes.n then + if hw_modes.g then + mode:value("11ng", "2.4GHz (802.11g+n)") + mode:value("11n", "2.4GHz (802.11n)") + end + if hw_modes.a then + mode:value("11na", "5GHz (802.11a+n)") + mode:value("11n", "5GHz (802.11n)") + end + htmode = s:taboption("advanced", ListValue, "htmode", translate("HT mode (802.11n)")) + htmode:depends("hwmode", "11ng") + htmode:depends("hwmode", "11na") + htmode:depends("hwmode", "11n") + htmode:value("HT20", "20MHz") + htmode:value("HT40", "40MHz") + end + ant1 = s:taboption("advanced", ListValue, "txantenna", translate("Transmitter Antenna")) ant1.widget = "radio" ant1:depends("diversity", "")