2012-12-15 10:01:00 +08:00
|
|
|
#!/bin/sh
|
2013-04-03 18:01:07 +08:00
|
|
|
# Copyright (C) 2012-2013 OpenWrt.org
|
2012-12-15 10:01:00 +08:00
|
|
|
|
2013-04-03 18:01:07 +08:00
|
|
|
. /lib/functions/leds.sh
|
2012-12-15 10:01:00 +08:00
|
|
|
|
2013-04-03 18:01:07 +08:00
|
|
|
status_led="power"
|
2012-12-15 10:01:00 +08:00
|
|
|
|
2013-04-03 18:01:07 +08:00
|
|
|
set_state() {
|
2013-06-10 16:25:02 +08:00
|
|
|
[ -d /sys/class/leds/power2/ ] && {
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
preinit)
|
|
|
|
led_set_attr "power2" "trigger" "heartbeat"
|
|
|
|
status_led_on
|
|
|
|
;;
|
|
|
|
failsafe)
|
|
|
|
led_off "power2"
|
|
|
|
status_led_set_timer 100 100
|
|
|
|
;;
|
|
|
|
done)
|
|
|
|
led_off "power2"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2012-12-15 10:01:00 +08:00
|
|
|
case "$1" in
|
|
|
|
preinit)
|
2013-04-03 18:01:07 +08:00
|
|
|
status_led_set_heartbeat
|
2012-12-15 10:01:00 +08:00
|
|
|
;;
|
|
|
|
failsafe)
|
2013-04-03 18:01:07 +08:00
|
|
|
[ -d /sys/class/leds/power1 ] && {
|
|
|
|
status_led_off
|
|
|
|
led_timer "power1" 100 100
|
|
|
|
} || status_led_set_timer 100 100
|
2012-12-15 10:01:00 +08:00
|
|
|
;;
|
|
|
|
done)
|
2013-04-03 18:01:07 +08:00
|
|
|
status_led_on
|
|
|
|
led_off "power1"
|
2012-12-15 10:01:00 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|