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
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
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()
]]--
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")
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