<commit_before>--[[
LuCI - Lua Configuration Interface

Copyright 2008 <NAME> <<EMAIL>>

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

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 ipairs(leds) do
	sysfs:value(v)
end

s:option(Flag, "default").rmempty = true


trigger = s:option(ListValue, "trigger")

--local triggers = luci.fs.readfile(sysfs_path .. leds[1] .. "/trigger")
triggers = "[none] netdev heartbeat default-on timer"<commit_msg>modules/admin-full: Removed accidently remaining debug dummy stuff<commit_after>--[[
LuCI - Lua Configuration Interface

Copyright 2008 <NAME> <<EMAIL>>

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

local sysfs_path = "/sys/class/leds/"
local leds = {}

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 ipairs(leds) do
	sysfs:value(v)
end

s:option(Flag, "default").rmempty = true


trigger = s:option(ListValue, "trigger")

local triggers = luci.fs.readfile(sysfs_path .. leds[1] .. "/trigger")
{'fraction_non_alphanumeric': 0.16069868995633188, 'fraction_numerical': 0.009170305676855894, 'mean_word_length': 4.024122807017544, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3312191', 'n_tokens_mistral': 874, 'n_tokens_neox': 836, 'n_words': 239}