forked from koenkooi/validation-scripts
-
Notifications
You must be signed in to change notification settings - Fork 24
/
testled
executable file
·43 lines (36 loc) · 1.11 KB
/
testled
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
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
led="/sys/class/leds/beagleboard::"
get_led_state () {
usr0_trigger=`cat ${led}usr0/trigger | sed -e "s/^.*\[\(.*\)\].*$/\1/"`
usr1_trigger=`cat ${led}usr1/trigger | sed -e "s/^.*\[\(.*\)\].*$/\1/"`
usr0_brightness=`cat ${led}usr0/brightness`
usr1_brightness=`cat ${led}usr1/brightness`
echo "USR0 LED state ($usr0_brightness) [$usr0_trigger]"
echo "USR1 LED state ($usr1_brightness) [$usr1_trigger]"
}
get_led_state
save0t="$usr0_trigger"
save0b="$usr0_brightness"
save1t="$usr1_trigger"
save1b="$usr1_brightness"
echo "Turning LEDs on for 3 seconds..."
echo "none" > ${led}usr0/trigger
echo "none" > ${led}usr1/trigger
echo "1" > ${led}usr0/brightness
echo "1" > ${led}usr1/brightness
get_led_state
sleep 3
echo "Turning USR0 LED off for 3 seconds..."
echo "0" > ${led}usr0/brightness
get_led_state
sleep 3
echo "Turning USR1 LED off for 3 seconds..."
echo "0" > ${led}usr1/brightness
get_led_state
sleep 3
echo "Restoring LEDs to their original state..."
echo "$save0b" > ${led}usr0/brightness
echo "$save1t" > ${led}usr1/brightness
echo "$save0t" > ${led}usr0/trigger
echo "$save1t" > ${led}usr1/trigger
get_led_state