diff options
Diffstat (limited to 'recipes/angstrom/angstrom-led-config/led-config')
-rwxr-xr-x | recipes/angstrom/angstrom-led-config/led-config | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/recipes/angstrom/angstrom-led-config/led-config b/recipes/angstrom/angstrom-led-config/led-config new file mode 100755 index 0000000000..63d52d6cd0 --- /dev/null +++ b/recipes/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 |