2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
14 require("luci.tools.webadmin")
17 m = Map("wireless", translate("networks"), translate("a_w_networks1"))
19 s = m:section(NamedSection, arg[1], "wifi-device", translate("device") .. " " .. arg[1])
22 en = s:option(Flag, "disabled", translate("enable"))
26 function en.cfgvalue(self, section)
27 return Flag.cfgvalue(self, section) or "0"
30 s:option(DummyValue, "type", translate("type"))
31 local hwtype = m:get(arg[1], "type")
33 mode = s:option(ListValue, "mode", translate("mode"))
34 mode:value("", "standard")
35 mode:value("11b", "802.11b")
36 mode:value("11g", "802.11g")
37 mode:value("11a", "802.11a")
38 mode:value("11bg", "802.11b+g")
40 if hwtype == "atheros" then
41 mode:value("11gdt", "802.11adt")
42 mode:value("11adt", "802.11adt")
43 mode:value("fh", "fh")
49 ch = s:option(Value, "channel", translate("a_w_channel"))
51 ch:value(i, i .. " (2.4 GHz)")
54 ch:value(i, i .. " (5 GHz)")
57 ch:value(i, i .. " (5 GHz)")
59 ch:value(147, 147 .. " (5 GHz)")
60 ch:value(151, 151 .. " (5 GHz)")
61 ch:value(155, 155 .. " (5 GHz)")
62 ch:value(167, 167 .. " (5 GHz)")
64 s:option(Value, "txantenna", translate("a_w_txantenna")).optional = true
66 s:option(Value, "rxantenna", translate("a_w_rxantenna")).optional = true
68 s:option(Value, "distance", translate("distance"),
69 translate("a_w_distance1")).optional = true
71 s:option(Value, "diversity", translate("a_w_diversity")):depends("type", "atheros")
73 country = s:option(Value, "country", translate("a_w_countrycode"))
74 country.optional = true
75 country:depends("type", "broadcom")
77 maxassoc = s:option(Value, "maxassoc", translate("a_w_connlimit"))
78 maxassoc:depends("type", "broadcom")
79 maxassoc.optional = true
83 ----------------------- Interface -----------------------
85 s = m:section(TypedSection, "wifi-iface", translate("interfaces"))
88 s:depends("device", arg[1])
89 s.defaults.device = arg[1]
91 s:option(Value, "ssid", translate("a_w_netid")).maxlength = 32
93 network = s:option(Value, "network", translate("network"), translate("a_w_network1"))
94 network.rmempty = true
96 network.combobox_manual = translate("a_w_netmanual")
97 luci.tools.webadmin.cbi_add_networks(network)
99 function network.write(self, section, value)
100 if not m.uci:get("network", value) then
102 m.uci:set("network", value, "interface")
103 Value.write(self, section, value)
105 if m.uci:get("network", value) == "interface" then
106 Value.write(self, section, value)
111 mode = s:option(ListValue, "mode", translate("mode"))
112 mode:value("ap", translate("a_w_ap"))
113 mode:value("adhoc", translate("a_w_adhoc"))
114 mode:value("ahdemo", translate("a_w_ahdemo"))
115 mode:value("sta", translate("a_w_client"))
116 mode:value("monitor", translate("a_w_monitor"))
118 if hwtype ~= "atheros" then
119 mode:value("wds", translate("a_w_wds"))
122 if hwtype == "atheros" then
123 s:option(Flag, "wds", translate("a_w_wds"))
126 s:option(Value, "bssid", "BSSID").optional = true
128 s:option(Value, "txpower", translate("a_w_txpwr"), "dbm").rmempty = true
130 s:option(Flag, "frameburst", translate("a_w_brcmburst")).optional = true
131 s:option(Flag, "bursting", translate("a_w_athburst")).optional = true
134 encr = s:option(ListValue, "encryption", translate("encryption"))
135 encr:value("none", "keine")
136 encr:value("wep", "WEP")
137 encr:value("PSK", "WPA-PSK")
138 encr:value("WPA", "WPA-EAP", {mode="ap"}, {mode="sta"})
139 encr:value("PSK2", "WPA2-PSK")
140 encr:value("WPA2", "WPA2-EAP", {mode="ap"}, {mode="sta"})
141 encr:depends("mode", "ap")
142 encr:depends("mode", "sta")
143 encr:depends("mode", "wds")
145 server = s:option(Value, "server", translate("a_w_radiussrv"))
146 server:depends({mode="ap", encryption="WPA"})
147 server:depends({mode="ap", encryption="WPA2"})
148 server.rmempty = true
150 port = s:option(Value, "port", translate("a_w_radiusport"))
151 port:depends({mode="ap", encryption="WPA"})
152 port:depends({mode="ap", encryption="WPA2"})
155 key = s:option(Value, "key", translate("key"))
156 key:depends("encryption", "wep")
157 key:depends("encryption", "PSK")
158 key:depends({mode="ap", encryption="WPA"})
159 key:depends("encryption", "PSK2")
160 key:depends({mode="ap", encryption="WPA2"})
163 nasid = s:option(Value, "nasid", translate("a_w_nasid"))
164 nasid:depends({mode="ap", encryption="WPA"})
165 nasid:depends({mode="ap", encryption="WPA2"})
168 eaptype = s:option(ListValue, "eap_type", translate("a_w_eaptype"))
170 eaptype:value("PEAP")
171 eaptype:depends({mode="sta", encryption="WPA"})
172 eaptype:depends({mode="sta", encryption="WPA2"})
174 cacert = s:option(Value, "ca_cert", translate("a_w_cacert"))
175 cacert:depends({mode="sta", encryption="WPA"})
176 cacert:depends({mode="sta", encryption="WPA2"})
178 privkey = s:option(Value, "priv_key", translate("a_w_tlsprivkey"))
179 privkey:depends({mode="sta", eap_type="TLS", encryption="WPA2"})
180 privkey:depends({mode="sta", eap_type="TLS", encryption="WPA"})
182 privkeypwd = s:option(Value, "priv_key_pwd", translate("a_w_tlsprivkeypwd"))
183 privkeypwd:depends({mode="sta", eap_type="TLS", encryption="WPA2"})
184 privkeypwd:depends({mode="sta", eap_type="TLS", encryption="WPA"})
187 auth = s:option(Value, "auth", translate("a_w_peapauth"))
188 auth:depends({mode="sta", eap_type="PEAP", encryption="WPA2"})
189 auth:depends({mode="sta", eap_type="PEAP", encryption="WPA"})
191 identity = s:option(Value, "identity", translate("a_w_peapidentity"))
192 identity:depends({mode="sta", eap_type="PEAP", encryption="WPA2"})
193 identity:depends({mode="sta", eap_type="PEAP", encryption="WPA"})
195 password = s:option(Value, "password", translate("a_w_peappassword"))
196 password:depends({mode="sta", eap_type="PEAP", encryption="WPA2"})
197 password:depends({mode="sta", eap_type="PEAP", encryption="WPA"})
202 s:option(Flag, "isolate", translate("a_w_apisolation"), translate("a_w_apisolation1")).optional = true
204 s:option(Flag, "hidden", translate("a_w_hideessid")).optional = true