summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full/luasrc/model/cbi
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/model/cbi')
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua28
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua47
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi_add.lua4
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/admin.lua4
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab/mount.lua10
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua15
6 files changed, 99 insertions, 9 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua
index ac02b156e9..1970f36a28 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/routes.lua
@@ -34,13 +34,27 @@ g.rmempty = true
metric = s:option(Value, "metric", translate("Metric"))
metric.placeholder = 0
metric.datatype = "range(0,255)"
+metric.size = 5
metric.rmempty = true
mtu = s:option(Value, "mtu", translate("MTU"))
mtu.placeholder = 1500
mtu.datatype = "range(64,9000)"
+mtu.size = 5
mtu.rmempty = true
+routetype = s:option(Value, "type", translate("Route type"))
+routetype:value("", "unicast")
+routetype:value("local", "local")
+routetype:value("broadcast", "broadcast")
+routetype:value("multicast", "multicast")
+routetype:value("unreachable", "unreachable")
+routetype:value("prohibit", "prohibit")
+routetype:value("blackhole", "blackhole")
+routetype:value("anycast", "anycast")
+routetype.default = ""
+routetype.rmempty = true
+
if fs.access("/proc/net/ipv6_route") then
s = m:section(TypedSection, "route6", translate("Static IPv6 Routes"))
s.addremove = true
@@ -62,12 +76,26 @@ if fs.access("/proc/net/ipv6_route") then
metric = s:option(Value, "metric", translate("Metric"))
metric.placeholder = 0
metric.datatype = "range(0,65535)" -- XXX: not sure
+ metric.size = 5
metric.rmempty = true
mtu = s:option(Value, "mtu", translate("MTU"))
mtu.placeholder = 1500
mtu.datatype = "range(64,9000)"
+ mtu.size = 5
mtu.rmempty = true
+
+ routetype = s:option(Value, "type", translate("Route type"))
+ routetype:value("", "unicast")
+ routetype:value("local", "local")
+ routetype:value("broadcast", "broadcast")
+ routetype:value("multicast", "multicast")
+ routetype:value("unreachable", "unreachable")
+ routetype:value("prohibit", "prohibit")
+ routetype:value("blackhole", "blackhole")
+ routetype:value("anycast", "anycast")
+ routetype.default = ""
+ routetype.rmempty = true
end
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua
index 09763e8f14..afe0d662b7 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua
@@ -42,6 +42,9 @@ end
-- wireless toggle was requested, commit and reload page
function m.parse(map)
+ local new_cc = m:formvalue("cbid.wireless.%s.country" % wdev:name())
+ local old_cc = m:get(wdev:name(), "country")
+
if m:formvalue("cbid.wireless.%s.__toggle" % wdev:name()) then
if wdev:get("disabled") == "1" or wnet:get("disabled") == "1" then
wnet:set("disabled", nil)
@@ -56,7 +59,14 @@ function m.parse(map)
luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless", arg[1]))
return
end
+
Map.parse(map)
+
+ if m:get(wdev:name(), "type") == "mac80211" and new_cc and new_cc ~= old_cc then
+ luci.sys.call("iw reg set %q" % new_cc)
+ luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless", arg[1]))
+ return
+ end
end
m.title = luci.util.pcdata(wnet:get_i18n())
@@ -94,7 +104,7 @@ local function txpower_current(pwr, list)
end
end
end
- return (list[#list] and list[#list].driver_dbm) or pwr or 0
+ return pwr or ""
end
local iw = luci.sys.wifi.getiwinfo(arg[1])
@@ -191,7 +201,7 @@ end
------------------- MAC80211 Device ------------------
if hwtype == "mac80211" then
- if #tx_power_list > 1 then
+ if #tx_power_list > 0 then
tp = s:taboption("general", ListValue,
"txpower", translate("Transmit Power"), "dBm")
tp.rmempty = true
@@ -200,6 +210,7 @@ if hwtype == "mac80211" then
return txpower_current(Value.cfgvalue(...), tx_power_list)
end
+ tp:value("", translate("auto"))
for _, p in ipairs(tx_power_list) do
tp:value(p.driver_dbm, "%i dBm (%i mW)"
%{ p.display_dbm, p.display_mw })
@@ -251,6 +262,7 @@ if hwtype == "atheros" then
return txpower_current(Value.cfgvalue(...), tx_power_list)
end
+ tp:value("", translate("auto"))
for _, p in ipairs(tx_power_list) do
tp:value(p.driver_dbm, "%i dBm (%i mW)"
%{ p.display_dbm, p.display_mw })
@@ -308,11 +320,42 @@ if hwtype == "broadcom" then
return txpower_current(Value.cfgvalue(...), tx_power_list)
end
+ tp:value("", translate("auto"))
for _, p in ipairs(tx_power_list) do
tp:value(p.driver_dbm, "%i dBm (%i mW)"
%{ p.display_dbm, p.display_mw })
end
+ mode = s:taboption("advanced", ListValue, "hwmode", translate("Band"))
+ if hw_modes.b then
+ mode:value("11b", "2.4GHz (802.11b)")
+ if hw_modes.g then
+ mode:value("11bg", "2.4GHz (802.11b+g)")
+ end
+ end
+ if hw_modes.g then
+ mode:value("11g", "2.4GHz (802.11g)")
+ mode:value("11gst", "2.4GHz (802.11g + Turbo)")
+ mode:value("11lrs", "2.4GHz (802.11g Limited Rate Support)")
+ end
+ if hw_modes.a then mode:value("11a", "5GHz (802.11a)") end
+ if hw_modes.n then
+ if hw_modes.g then
+ mode:value("11ng", "2.4GHz (802.11g+n)")
+ mode:value("11n", "2.4GHz (802.11n)")
+ end
+ if hw_modes.a then
+ mode:value("11na", "5GHz (802.11a+n)")
+ mode:value("11n", "5GHz (802.11n)")
+ end
+ htmode = s:taboption("advanced", ListValue, "htmode", translate("HT mode (802.11n)"))
+ htmode:depends("hwmode", "11ng")
+ htmode:depends("hwmode", "11na")
+ htmode:depends("hwmode", "11n")
+ htmode:value("HT20", "20MHz")
+ htmode:value("HT40", "40MHz")
+ end
+
ant1 = s:taboption("advanced", ListValue, "txantenna", translate("Transmitter Antenna"))
ant1.widget = "radio"
ant1:depends("diversity", "")
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi_add.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi_add.lua
index 05b27a9f0c..8277deb2f6 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi_add.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi_add.lua
@@ -16,7 +16,7 @@ if not iw then
return
end
-m = SimpleForm("network", translate("Joining Network: %q", http.formvalue("join")))
+m = SimpleForm("network", translatef("Joining Network: %q", http.formvalue("join")))
m.cancel = translate("Back to scan results")
m.reset = false
@@ -44,7 +44,7 @@ m.hidden = {
if iw and iw.mbssid_support then
replace = m:field(Flag, "replace", translate("Replace wireless configuration"),
- translate("An additional network will be created if you leave this checked."))
+ translate("Check this option to delete the existing networks from this radio."))
function replace.cfgvalue() return "0" end
else
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/admin.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/admin.lua
index 1e475640be..493a735bde 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/admin.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/admin.lua
@@ -21,7 +21,7 @@ function s.cfgsections()
return { "_pass" }
end
-function m.on_commit(map)
+function m.parse(map)
local v1 = pw1:formvalue("_pass")
local v2 = pw2:formvalue("_pass")
@@ -36,6 +36,8 @@ function m.on_commit(map)
m.message = translate("Given password confirmation did not match, password not changed!")
end
end
+
+ Map.parse(map)
end
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab/mount.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab/mount.lua
index f5751673fd..a85872afad 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab/mount.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/fstab/mount.lua
@@ -56,6 +56,8 @@ mount:taboption("general", Flag, "enabled", translate("Enable this mount")).rmem
o = mount:taboption("general", Value, "uuid", translate("UUID"),
translate("If specified, mount the device by its UUID instead of a fixed device node"))
+o:value("", translate("-- match by uuid --"))
+
for i, d in ipairs(devices) do
if d.uuid and d.size then
o:value(d.uuid, "%s (%s, %d MB)" %{ d.uuid, d.dev, d.size })
@@ -64,12 +66,12 @@ for i, d in ipairs(devices) do
end
end
-o:value("", translate("-- match by label --"))
-
o = mount:taboption("general", Value, "label", translate("Label"),
translate("If specified, mount the device by the partition label instead of a fixed device node"))
+o:value("", translate("-- match by label --"))
+
o:depends("uuid", "")
for i, d in ipairs(devices) do
@@ -80,12 +82,12 @@ for i, d in ipairs(devices) do
end
end
-o:value("", translate("-- match by device --"))
-
o = mount:taboption("general", Value, "device", translate("Device"),
translate("The device file of the memory or partition (<abbr title=\"for example\">e.g.</abbr> <code>/dev/sda1</code>)"))
+o:value("", translate("-- match by device --"))
+
o:depends({ uuid = "", label = "" })
for i, d in ipairs(devices) do
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua
index 8d9bcb1371..4b6f397e6a 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/leds.lua
@@ -109,6 +109,13 @@ function usbdev.remove(self, section)
end
end
+
+usbport = s:option(MultiValue, "ports", translate("USB Ports"))
+usbport:depends("trigger", "usbport")
+usbport.rmempty = true
+usbport.widget = "checkbox"
+usbport.size = 1
+
for p in nixio.fs.glob("/sys/bus/usb/devices/[0-9]*/manufacturer") do
local id = p:match("%d+-%d+")
local mf = nixio.fs.readfile("/sys/bus/usb/devices/" .. id .. "/manufacturer") or "?"
@@ -116,4 +123,12 @@ for p in nixio.fs.glob("/sys/bus/usb/devices/[0-9]*/manufacturer") do
usbdev:value(id, "%s (%s - %s)" %{ id, mf, pr })
end
+for p in nixio.fs.glob("/sys/bus/usb/devices/[0-9]*") do
+ local bus, port = p:match("(%d+)-(%d+)")
+ if bus and port then
+ usbport:value("usb%u-port%u" %{ tonumber(bus), tonumber(port) },
+ "Hub %u, Port %u" %{ tonumber(bus), tonumber(port) })
+ end
+end
+
return m