From: Florian Eckert Date: Sun, 4 Jun 2017 16:49:27 +0000 (+0200) Subject: luci-mod-admin-full: no menu entry for leds if "/sys/class/leds" is empty X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=690ae5c211a5c5481cf180d71fe960c3f04a5e7e;p=project%2Fluci.git luci-mod-admin-full: no menu entry for leds if "/sys/class/leds" is empty Signed-off-by: Florian Eckert Signed-off-by: Yousong Zhou --- diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua index 51f9d9d7b6..85bf3b6867 100644 --- a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua +++ b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua @@ -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"), _("LED Configuration"), 60) end