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
+local fs = require "nixio.fs"
+local util = require "nixio.util"
+
+if fs.access(sysfs_path) then
+ leds = util.consume((fs.dir(sysfs_path)))
end
if #leds == 0 then
trigger = s:option(ListValue, "trigger")
-local triggers = luci.fs.readfile(sysfs_path .. leds[1] .. "/trigger")
+local triggers = fs.readfile(sysfs_path .. leds[1] .. "/trigger")
for t in triggers:gmatch("[%w-]+") do
trigger:value(t, translate("system_led_trigger_" .. t:gsub("-", "")))
end
mode:value("tx", translate("system_led_mode_tx"))
mode:value("rx", translate("system_led_mode_rx"))
-return m
\ No newline at end of file
+return m