summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2017-01-03 15:54:57 +0100
committerJo-Philipp Wich <jo@mein.io>2017-01-26 00:39:38 +0100
commit1cd096d2913fbf277d9c88aeda6e7137c646c529 (patch)
tree1ccb2c7bdd104d00d3e96237ed9838f20c1e9911 /modules/luci-mod-admin-full
parent7cd9ecff001fa0a76d6df611db02bbcaf66a1024 (diff)
luci-mod-admin-full: allow unset txpower value
Sometimes txpower is not set so we should have an option with empty value to let it stay unset. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'modules/luci-mod-admin-full')
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua7
1 files changed, 5 insertions, 2 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 2dff4ddc81..91d092978c 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
@@ -94,7 +94,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 +191,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 +200,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 +252,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,6 +310,7 @@ 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 })