diff options
-rw-r--r-- | i18n/english/luasrc/i18n/admin-core.en.lua | 22 | ||||
-rw-r--r-- | i18n/german/luasrc/i18n/admin-core.de.lua | 24 | ||||
-rw-r--r-- | modules/admin-full/luasrc/controller/admin/system.lua | 21 | ||||
-rw-r--r-- | modules/admin-full/luasrc/model/cbi/admin_system/leds.lua | 56 |
4 files changed, 103 insertions, 20 deletions
diff --git a/i18n/english/luasrc/i18n/admin-core.en.lua b/i18n/english/luasrc/i18n/admin-core.en.lua index 4a293d881..348c8065e 100644 --- a/i18n/english/luasrc/i18n/admin-core.en.lua +++ b/i18n/english/luasrc/i18n/admin-core.en.lua @@ -288,3 +288,25 @@ bitrate = "Bitrate" m_n_keepalive = "automatically reconnect" m_n_dialondemand = "disconnect when idle for" m_n_pptp_server = "PPTP-Server" + +leds = "LED Configuration" +leds_desc = "Customizes the behaviour of the device LEDs if possible." +system_led_name = "LED Name" +system_led_sysfs = "LED Device" +system_led_default = "Default state" +system_led_default_desc = "ticked = on" +system_led_trigger = "Trigger" +system_led_trigger_none = "None" +system_led_trigger_defaulton = "Default On" +system_led_trigger_timer = "Timer" +system_led_trigger_heartbeat = "Heartbeat (Load Average)" +system_led_trigger_netdev = "Network Device" +system_led_delayoff = "Off-State Delay" +system_led_delayoff_desc = "Time (in ms) the LED is off" +system_led_delayon = "On-State Delay" +system_led_delayon_desc = "Time (in ms) the LED is on" +system_led_dev = "Device" +system_led_mode = "Trigger Mode" +system_led_mode_link = "Link On" +system_led_mode_tx = "Transmit" +system_led_mode_rx = "Receive"
\ No newline at end of file diff --git a/i18n/german/luasrc/i18n/admin-core.de.lua b/i18n/german/luasrc/i18n/admin-core.de.lua index 5522fd210..128deda5c 100644 --- a/i18n/german/luasrc/i18n/admin-core.de.lua +++ b/i18n/german/luasrc/i18n/admin-core.de.lua @@ -292,4 +292,26 @@ a_s_backup_reset = "Grundeinstellungen wiederherstellen" a_s_backup_reset1 = "Alle aktuellen Einstellungen verwerfen und Grundeinstellungen wiederherstellen?" a_s_backup_restore = "Sicherung wiederherstellen" a_s_backup1 = [[Auf dieser Seite können Sicherungen der Konfiguration erstellt und eingespielt werden -und - wenn möglich - die Grundeinstellungen wiederhergestellt werden.]]
\ No newline at end of file +und - wenn möglich - die Grundeinstellungen wiederhergestellt werden.]] + +leds = "LED Konfiguration" +leds_desc = "Passt das Verhalten der Geräte-LEDs an - wenn dies möglich ist." +system_led_name = "LED Name" +system_led_sysfs = "LED Gerät" +system_led_default = "Grundzustand" +system_led_default_desc = "ausgewählt = an" +system_led_trigger = "Auslöser" +system_led_trigger_none = "Keiner" +system_led_trigger_defaulton = "Immer an" +system_led_trigger_timer = "Taktgeber" +system_led_trigger_heartbeat = "Herzschlag (Mittlere Systemlast)" +system_led_trigger_netdev = "Netzwerkschnittstelle" +system_led_delayoff = "Einschaltverzögerung" +system_led_delayoff_desc = "Zeit (in ms) die die LED deaktiviert ist" +system_led_delayon = "Ausschaltverzögerung" +system_led_delayon_desc = "Zeit (in ms) die die LED aktiviert ist" +system_led_dev = "Schnittstelle" +system_led_mode = "Auslösemodus" +system_led_mode_link = "Verbindung hergestellt" +system_led_mode_tx = "Senden" +system_led_mode_rx = "Empfangen"
\ No newline at end of file diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index 9abdb2aba..3ebaebcee 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -17,16 +17,17 @@ function index() luci.i18n.loadc("admin-core") local i18n = luci.i18n.translate - entry({"admin", "system"}, template("admin_system/index"), i18n("system", "System"), 30) - entry({"admin", "system", "packages"}, call("action_packages"), i18n("a_s_packages", "Paketverwaltung"), 10) - entry({"admin", "system", "packages", "ipkg"}, call("action_ipkg"), i18n("a_s_p_ipkg", "IPKG-Konfiguration")) - entry({"admin", "system", "passwd"}, call("action_passwd"), i18n("a_s_changepw", "Passwort ändern"), 20) - entry({"admin", "system", "sshkeys"}, call("action_sshkeys"), i18n("a_s_sshkeys", "SSH-Schlüssel"), 30) - entry({"admin", "system", "system"}, cbi("admin_system/system"), i18n("system", "System"), 40) - entry({"admin", "system", "fstab"}, cbi("admin_system/fstab"), i18n("a_s_fstab", "Einhängepunkte"), 50) - entry({"admin", "system", "backup"}, call("action_backup"), i18n("a_s_backup"), 60) - entry({"admin", "system", "upgrade"}, call("action_upgrade"), i18n("a_s_flash", "Firmwareupgrade"), 70) - entry({"admin", "system", "reboot"}, call("action_reboot"), i18n("reboot", "Neu starten"), 80) + entry({"admin", "system"}, template("admin_system/index"), i18n("system"), 30) + entry({"admin", "system", "packages"}, call("action_packages"), i18n("a_s_packages"), 10) + entry({"admin", "system", "packages", "ipkg"}, call("action_ipkg"), i18n("a_s_p_ipkg")) + entry({"admin", "system", "passwd"}, call("action_passwd"), i18n("a_s_changepw"), 20) + entry({"admin", "system", "sshkeys"}, call("action_sshkeys"), i18n("a_s_sshkeys"), 30) + entry({"admin", "system", "system"}, cbi("admin_system/system"), i18n("system"), 40) + entry({"admin", "system", "fstab"}, cbi("admin_system/fstab"), i18n("a_s_fstab"), 50) + entry({"admin", "system", "leds"}, cbi("admin_system/leds"), i18n("leds", "LEDs"), 60) + entry({"admin", "system", "backup"}, call("action_backup"), i18n("a_s_backup"), 70) + entry({"admin", "system", "upgrade"}, call("action_upgrade"), i18n("a_s_flash"), 80) + entry({"admin", "system", "reboot"}, call("action_reboot"), i18n("reboot"), 90) end function action_editor() diff --git a/modules/admin-full/luasrc/model/cbi/admin_system/leds.lua b/modules/admin-full/luasrc/model/cbi/admin_system/leds.lua index 100f03159..0acb7479b 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_system/leds.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_system/leds.lua @@ -13,25 +13,58 @@ $Id$ ]]-- m = Map("system", translate("leds"), translate("leds_desc")) +local sysfs_path = "/sys/class/leds/" +local leds = {} +leds[1] = "moep" + +if luci.fs.access(sysfs_path) then + for k, v in pairs(luci.fs.dir(sysfs_path)) do + if v ~= "." and v ~= ".." then + table.insert(leds, v) + end + end +end + +if #leds == 0 then + return m +end + + s = m:section(TypedSection, "led", "") s.anonymous = true s.addremove = true +function s.parse(self, ...) + TypedSection.parse(self, ...) + os.execute("/etc/init.d/led enable") +end + 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 +for k, v in ipairs(leds) do + sysfs:value(v) end s:option(Flag, "default").rmempty = true -trigger = s:option(Value, "trigger") -trigger.rmempty = true -trigger:value("netdev") + +trigger = s:option(ListValue, "trigger") + +--local triggers = luci.fs.readfile(sysfs_path .. leds[1] .. "/trigger") +triggers = "[none] netdev heartbeat default-on timer" +for t in triggers:gmatch("[%w-]+") do + trigger:value(t, translate("system_led_trigger_" .. t:gsub("-", ""))) +end + + +delayon = s:option(Value, "delayon") +delayon:depends("trigger", "timer") + +delayoff = s:option(Value, "delayoff") +delayoff:depends("trigger", "timer") dev = s:option(ListValue, "dev") @@ -44,7 +77,12 @@ for k, v in pairs(luci.sys.net.devices()) do end end -mode = s:option(Value, "mode") + +mode = s:option(MultiValue, "mode") mode.rmempty = true -mode:value("link") mode:depends("trigger", "netdev") +mode:value("link", translate("system_led_mode_link")) +mode:value("tx", translate("system_led_mode_tx")) +mode:value("rx", translate("system_led_mode_rx")) + +return m
\ No newline at end of file |