modules/admin-full: Prepare Button / LED configuration
This commit is contained in:
parent
a89101e5e5
commit
6b32f06b1a
2 changed files with 81 additions and 0 deletions
31
modules/admin-full/luasrc/model/cbi/admin_system/buttons.lua
Normal file
31
modules/admin-full/luasrc/model/cbi/admin_system/buttons.lua
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
--[[
|
||||||
|
LuCI - Lua Configuration Interface
|
||||||
|
|
||||||
|
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
]]--
|
||||||
|
m = Map("system", translate("buttons"), translate("buttons_desc"))
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "button", "")
|
||||||
|
s.anonymous = true
|
||||||
|
s.addremove = true
|
||||||
|
|
||||||
|
s:option(Value, "button")
|
||||||
|
|
||||||
|
act = s:option(ListValue, "action")
|
||||||
|
act:value("released")
|
||||||
|
|
||||||
|
s:option(Value, "handler")
|
||||||
|
|
||||||
|
min = s:option(Value, "min")
|
||||||
|
min.rmempty = true
|
||||||
|
|
||||||
|
max = s:option(Value, "max")
|
||||||
|
max.rmempty = true
|
50
modules/admin-full/luasrc/model/cbi/admin_system/leds.lua
Normal file
50
modules/admin-full/luasrc/model/cbi/admin_system/leds.lua
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
--[[
|
||||||
|
LuCI - Lua Configuration Interface
|
||||||
|
|
||||||
|
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
]]--
|
||||||
|
m = Map("system", translate("leds"), translate("leds_desc"))
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "led", "")
|
||||||
|
s.anonymous = true
|
||||||
|
s.addremove = true
|
||||||
|
|
||||||
|
|
||||||
|
s:option(Value, "name")
|
||||||
|
|
||||||
|
sysfs = s:option(ListValue, "sysfs")
|
||||||
|
for k, v in pairs(luci.fs.dir("/sys/class/leds/")) do
|
||||||
|
if v ~= "." and v ~= ".." then
|
||||||
|
sysfs:value(v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
s:option(Flag, "default").rmempty = true
|
||||||
|
|
||||||
|
trigger = s:option(Value, "trigger")
|
||||||
|
trigger.rmempty = true
|
||||||
|
trigger:value("netdev")
|
||||||
|
|
||||||
|
|
||||||
|
dev = s:option(ListValue, "dev")
|
||||||
|
dev.rmempty = true
|
||||||
|
dev:value("")
|
||||||
|
dev:depends("trigger", "netdev")
|
||||||
|
for k, v in pairs(luci.sys.net.devices()) do
|
||||||
|
if v ~= "lo" then
|
||||||
|
dev:value(v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
mode = s:option(Value, "mode")
|
||||||
|
mode.rmempty = true
|
||||||
|
mode:value("link")
|
||||||
|
mode:depends("trigger", "netdev")
|
Loading…
Reference in a new issue