summaryrefslogtreecommitdiff
path: root/packages/angstrom/angstrom-led-config/led-config
blob: 63d52d6cd03fec871c0a02c9ab70ac092896aa20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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