luci-mod-admin-full: no menu entry for leds if "/sys/class/leds" is empty
authorFlorian Eckert <[email protected]>
Sun, 4 Jun 2017 16:49:27 +0000 (18:49 +0200)
committerYousong Zhou <[email protected]>
Mon, 7 May 2018 13:14:48 +0000 (21:14 +0800)
Signed-off-by: Florian Eckert <[email protected]>
Signed-off-by: Yousong Zhou <[email protected]>
modules/luci-mod-admin-full/luasrc/controller/admin/system.lua

index 51f9d9d7b6386f2cc777f5a04c7f5cbb5b8d6566..85bf3b6867c83e6a515c3f924b7715daeb2241d7 100644 (file)
@@ -27,7 +27,8 @@ function index()
                entry({"admin", "system", "fstab", "swap"},  cbi("admin_system/fstab/swap"),  nil).leaf = true
        end
 
-       if fs.access("/sys/class/leds") then
+       local nodes, number = nixio.fs.glob("/sys/class/leds/*")
+       if number > 0 then
                entry({"admin", "system", "leds"}, cbi("admin_system/leds"), _("<abbr title=\"Light Emitting Diode\">LED</abbr> Configuration"), 60)
        end