summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-mini/luasrc
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-30 20:32:27 +0000
committerSteven Barth <steven@midlink.org>2008-08-30 20:32:27 +0000
commit5ff3750b37a0f4b0fffe225c4c1ea25485b8ab27 (patch)
treec3bd02d561996bd60a07a3a07d59f1f48cdc8a79 /modules/admin-mini/luasrc
parent05d6b9684c749f7e47ce5681a3e5455a9c554a69 (diff)
Completely rewrote WiFi configuration pages, to synchronise with upstream featureset of mac80211, madwifi and broadcom wireless configuration
Diffstat (limited to 'modules/admin-mini/luasrc')
-rw-r--r--modules/admin-mini/luasrc/model/cbi/mini/wifi.lua63
1 files changed, 47 insertions, 16 deletions
diff --git a/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua b/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
index 7aff62323..5f2e014f3 100644
--- a/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
+++ b/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
@@ -15,8 +15,10 @@ $Id$
-- Data init --
-local wireless = luci.model.uci.cursor_state():get_all("wireless")
+local wlcursor = luci.model.uci.cursor_state()
+local wireless = wlcursor:get_all("wireless")
local wifidata = luci.sys.wifi.getiwconfig()
+local wifidevs = {}
local ifaces = {}
for k, v in pairs(wireless) do
@@ -25,6 +27,11 @@ for k, v in pairs(wireless) do
end
end
+wlcursor:foreach("wireless", "wifi-device",
+ function(section)
+ table.insert(wifidevs, section[".name"])
+ end)
+
-- Main Map --
@@ -112,9 +119,14 @@ t2:option(DummyValue, "Signal level", translate("iwscan_signal"))
t2:option(DummyValue, "Noise level", translate("iwscan_noise"))
+
+if #wifidevs < 1 then
+ return m
+end
+
-- Config Section --
-s = m:section(TypedSection, "wifi-device", translate("devices"))
+s = m:section(NamedSection, wifidevs[1], "wifi-device", translate("devices"))
en = s:option(Flag, "disabled", translate("enable"))
en.enabled = "0"
@@ -125,13 +137,18 @@ function en.cfgvalue(self, section)
end
-mode = s:option(ListValue, "mode", translate("mode"))
-mode:value("", "standard")
-mode:value("11b", "802.11b")
-mode:value("11g", "802.11g")
-mode:value("11a", "802.11a")
-mode:value("11bg", "802.11b+g")
-mode.rmempty = true
+local hwtype = m:get(wifidevs[1], "type")
+
+if hwtype == "atheros" then
+ mode = s:option(ListValue, "mode", translate("mode"))
+ mode:value("", "auto")
+ mode:value("11b", "802.11b")
+ mode:value("11g", "802.11g")
+ mode:value("11a", "802.11a")
+ mode:value("11bg", "802.11b+g")
+ mode.rmempty = true
+end
+
ch = s:option(Value, "channel", translate("a_w_channel"))
for i=1, 14 do
@@ -142,7 +159,9 @@ end
s = m:section(TypedSection, "wifi-iface", translate("m_n_local"))
s.anonymous = true
-s:option(Value, "ssid", translate("a_w_netid")).maxlength = 32
+s:option(Value, "ssid", translate("a_w_netid"))
+
+bssid = s:option(Value, "bssid", translate("wifi_bssid"))
local devs = {}
luci.model.uci.cursor():foreach("wireless", "wifi-device",
@@ -212,12 +231,24 @@ port:depends("encryption", "wpa")
port:depends("encryption", "wpa2")
port.rmempty = true
-iso = s:option(Flag, "isolate", translate("a_w_apisolation"), translate("a_w_apisolation1"))
-iso.rmempty = true
-iso:depends("mode", "ap")
-hide = s:option(Flag, "hidden", translate("a_w_hideessid"))
-hide.rmempty = true
-hide:depends("mode", "ap")
+if hwtype == "atheros" or hwtype == "broadcom" then
+ iso = s:option(Flag, "isolate", translate("a_w_apisolation"), translate("a_w_apisolation1"))
+ iso.rmempty = true
+ iso:depends("mode", "ap")
+
+ hide = s:option(Flag, "hidden", translate("a_w_hideessid"))
+ hide.rmempty = true
+ hide:depends("mode", "ap")
+end
+
+if hwtype == "mac80211" or hwtype == "atheros" then
+ bssid:depends({mode="adhoc"})
+end
+
+if hwtype == "broadcom" then
+ bssid:depends({mode="wds"})
+end
+
return m \ No newline at end of file