summaryrefslogtreecommitdiff
path: root/packages/angstrom/angstrom-led-config/led-config
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2008-06-04 14:55:31 +0000
committerKoen Kooi <koen@openembedded.org>2008-06-04 14:55:31 +0000
commit8f52b3e590811ca645c13219d9b9a9191476aec3 (patch)
treebc268a64a90ee6b21bac6c21c1ccd1ad30c421d7 /packages/angstrom/angstrom-led-config/led-config
parent2d0ed5c61d9bb342721c32c220ff2b4b53452446 (diff)
angstrom led config: initscript that applies led config from /etc/default/leds
Diffstat (limited to 'packages/angstrom/angstrom-led-config/led-config')
-rwxr-xr-xpackages/angstrom/angstrom-led-config/led-config31
1 files changed, 31 insertions, 0 deletions
diff --git a/packages/angstrom/angstrom-led-config/led-config b/packages/angstrom/angstrom-led-config/led-config
new file mode 100755
index 0000000000..63d52d6cd0
--- /dev/null
+++ b/packages/angstrom/angstrom-led-config/led-config
@@ -0,0 +1,31 @@
+#! /bin/sh
+
+if [ -e /sys/class/leds/ ] ; then
+
+case "$1" in
+ start)
+ echo "Configuring leds:"
+ for led in /sys/class/leds/* ; do
+ trigger=$(grep "$(basename $led)" /etc/default/leds | awk '{print $2}')
+ if [ "x$trigger" = "x" ] ; then trigger="none" ; fi
+ echo " $(basename $led): $trigger"
+ echo "$trigger" > "$led/trigger"
+ done
+;;
+ stop)
+ echo "Deconfiguring leds:"
+ for led in /sys/class/leds/* ; do
+ echo " $(basename $led): no trigger"
+ echo "none" > "$led/trigger"
+ done
+ ;;
+ *)
+ echo "Usage: /etc/init.d/led-config {start|stop}"
+ exit 1
+esac
+
+else
+ echo "No LEDs detected"
+fi
+
+exit 0