summaryrefslogtreecommitdiff
path: root/package/base-files
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files')
-rw-r--r--package/base-files/files/lib/functions/leds.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions/leds.sh b/package/base-files/files/lib/functions/leds.sh
index 857e7e5..83e775f 100644
--- a/package/base-files/files/lib/functions/leds.sh
+++ b/package/base-files/files/lib/functions/leds.sh
@@ -1,6 +1,18 @@
#!/bin/sh
# Copyright (C) 2013 OpenWrt.org
+get_dt_led() {
+ local label
+ local ledpath
+ local basepath="/proc/device-tree"
+ local nodepath="$basepath/aliases/led-$1"
+
+ [ -f "$nodepath" ] && ledpath=$(cat "$nodepath")
+ [ -n "$ledpath" ] && label=$(cat "$basepath$ledpath/label")
+
+ echo "$label"
+}
+
led_set_attr() {
[ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
}