summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2012-06-18 19:42:39 +0000
committerDaniel Golle <daniel@makrotopia.org>2012-06-18 19:42:39 +0000
commitfb5d41c2a5aa751302375c0a31ca03d095145e93 (patch)
tree02c098cb099f618cd7c113316bd2325cd876caaf
parent78fd18c8e99a7f0a07c9253b718bfbe6660710df (diff)
Only show the TX-power selector if the hardware supports more than one option.
Some mac80211 drivers (rt2x00) probably won't support limiting TX-power to a user-defined value in the near future under certain conditions, so it makes sense to not expose that option in order not to confuse the user. See http://patchwork.openwrt.org/patch/2187/ to understand the situation. Signed-off-by: Daniel Golle <dgolle@allnet.de>
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua25
1 files changed, 12 insertions, 13 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 c502ea802..b407408a3 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua
@@ -201,20 +201,19 @@ end
------------------- MAC80211 Device ------------------
if hwtype == "mac80211" then
- tp = s:taboption("general",
- (#tx_power_list > 0) and ListValue or Value,
- "txpower", translate("Transmit Power"), "dBm")
-
- tp.rmempty = true
- tp.default = tx_power_cur
-
- function tp.cfgvalue(...)
- return txpower_current(Value.cfgvalue(...), tx_power_list)
- end
+ if #tx_power_list > 1 then
+ tp = s:taboption("general", ListValue,
+ "txpower", translate("Transmit Power"), "dBm")
+ tp.rmempty = true
+ tp.default = tx_power_cur
+ function tp.cfgvalue(...)
+ return txpower_current(Value.cfgvalue(...), tx_power_list)
+ end
- for _, p in ipairs(tx_power_list) do
- tp:value(p.driver_dbm, "%i dBm (%i mW)"
- %{ p.display_dbm, p.display_mw })
+ for _, p in ipairs(tx_power_list) do
+ tp:value(p.driver_dbm, "%i dBm (%i mW)"
+ %{ p.display_dbm, p.display_mw })
+ end
end
mode = s:taboption("advanced", ListValue, "hwmode", translate("Mode"))