projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Wifi-Client mode for devices without standard default network configuration
[project/luci.git]
/
modules
/
admin-mini
/
luasrc
/
model
/
cbi
/
mini
/
wifi.lua
diff --git
a/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
b/modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
index
31242b7
..
e1d5b39
100644
(file)
--- a/
modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
+++ b/
modules/admin-mini/luasrc/model/cbi/mini/wifi.lua
@@
-15,6
+15,13
@@
$Id$
-- Data init --
-- Data init --
+local uci = luci.model.uci.cursor()
+if not uci:get("network", "wan") then
+ uci:section("network", "interface", "wan", {proto="none", ifname=" "})
+ uci:save("network")
+ uci:commit("network")
+end
+
local wlcursor = luci.model.uci.cursor_state()
local wireless = wlcursor:get_all("wireless")
local wifidata = luci.sys.wifi.getiwconfig()
local wlcursor = luci.model.uci.cursor_state()
local wireless = wlcursor:get_all("wireless")
local wifidata = luci.sys.wifi.getiwconfig()
@@
-89,6
+96,7
@@
end
t2 = m:section(Table, {}, translate("iwscan"), translate("iwscan1"))
function scan.write(self, section)
t2 = m:section(Table, {}, translate("iwscan"), translate("iwscan1"))
function scan.write(self, section)
+ m.autoapply = false
t2.render = t2._render
local ifname = self.map:get(section, "ifname")
luci.util.update(t2.data, luci.sys.wifi.iwscan(ifname))
t2.render = t2._render
local ifname = self.map:get(section, "ifname")
luci.util.update(t2.data, luci.sys.wifi.iwscan(ifname))
@@
-127,8
+135,10
@@
end
-- Config Section --
s = m:section(NamedSection, wifidevs[1], "wifi-device", translate("devices"))
-- Config Section --
s = m:section(NamedSection, wifidevs[1], "wifi-device", translate("devices"))
+s.addremove = false
en = s:option(Flag, "disabled", translate("enable"))
en = s:option(Flag, "disabled", translate("enable"))
+en.rmempty = false
en.enabled = "0"
en.disabled = "1"
en.enabled = "0"
en.disabled = "1"
@@
-140,7
+150,7
@@
end
local hwtype = m:get(wifidevs[1], "type")
if hwtype == "atheros" then
local hwtype = m:get(wifidevs[1], "type")
if hwtype == "atheros" then
- mode = s:option(ListValue, "mode", translate("mode"))
+ mode = s:option(ListValue, "
hw
mode", translate("mode"))
mode.override_values = true
mode:value("", "auto")
mode:value("11b", "802.11b")
mode.override_values = true
mode:value("", "auto")
mode:value("11b", "802.11b")
@@
-185,12
+195,6
@@
mode:value("sta", translate("m_w_client"))
function mode.write(self, section, value)
if value == "sta" then
function mode.write(self, section, value)
if value == "sta" then
- -- ToDo: Move this away
- if not m.uci:get("network", "wan") then
- m.uci:set("network", "wan", "proto", "none")
- m.uci:set("network", "wan", "ifname", " ")
- end
-
local oldif = m.uci:get("network", "wan", "ifname")
if oldif and oldif ~= " " then
m.uci:set("network", "wan", "_ifname", oldif)
local oldif = m.uci:get("network", "wan", "ifname")
if oldif and oldif ~= " " then
m.uci:set("network", "wan", "_ifname", oldif)