local fs = require "nixio.fs"
arg[1] = arg[1] or ""
-arg[2] = arg[2] or ""
m = Map("wireless", "",
translate("The <em>Device Configuration</em> section covers physical settings of the radio " ..
local ifsection
function m.on_commit(map)
- local wnet = nw:get_wifinet(arg[2])
+ local wnet = nw:get_wifinet(arg[1])
if ifsection and wnet then
ifsection.section = wnet.sid
- m.title = wnet:get_i18n()
+ m.title = luci.util.pcdata(wnet:get_i18n())
end
end
nw.init(m.uci)
-local wnet = nw:get_wifinet(arg[2])
+local wnet = nw:get_wifinet(arg[1])
+local wdev = wnet and wnet:get_device()
-- redirect to overview page if network does not exist anymore (e.g. after a revert)
-if not wnet then
+if not wnet or not wdev then
luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless"))
return
end
-m.title = wnet:get_i18n()
+m.title = luci.util.pcdata(wnet:get_i18n())
local iw = luci.sys.wifi.getiwinfo(arg[1])
local hw_modes = iw.hwmodelist or { }
-s = m:section(NamedSection, arg[1], "wifi-device", translate("Device Configuration"))
+s = m:section(NamedSection, wdev:name(), "wifi-device", translate("Device Configuration"))
s.addremove = false
s:tab("general", translate("General Setup"))
st = s:taboption("general", DummyValue, "__status", translate("Status"))
st.template = "admin_network/wifi_status"
-st.ifname = arg[2]
+st.ifname = arg[1]
en = s:taboption("general", Flag, "disabled", translate("Enable device"))
en.enabled = "0"
end
-local hwtype = m:get(arg[1], "type")
-local htcaps = m:get(arg[1], "ht_capab") and true or false
+local hwtype = wdev:get("type")
+local htcaps = wdev:get("ht_capab") and true or false
-- NanoFoo
-local nsantenna = m:get(arg[1], "antenna")
+local nsantenna = wdev:get("antenna")
ch = s:taboption("general", Value, "channel", translate("Channel"))
ch:value("auto", translate("auto"))
ifsection = s
s.addremove = false
s.anonymous = true
-s.defaults.device = arg[1]
+s.defaults.device = wdev:name()
s:tab("general", translate("General Setup"))
s:tab("encryption", translate("Wireless Security"))
if not slot or slot < 1 or slot > 4 then
return 1
end
- return slot
+ return slot
end
wepslot.write = function(self, section, value)
wepkey.datatype = "wepkey"
wepkey.rmempty = true
wepkey.password = true
-
+
function wepkey.write(self, section, value)
if value and (#value == 5 or #value == 13) then
value = "s:" .. value