openwrt/target/linux/lantiq/base-files/etc/diag.sh
John Crispin f7daed8b9a lantiq: diag.sh with both red and green power LEDs
This provides a boot LED sequence suitable for devices with both red and
green LEDs for power. This assumes no "default-on" settings in the
device tree.

Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>

SVN-Revision: 36899
2013-06-10 08:25:02 +00:00

45 lines
629 B
Bash

#!/bin/sh
# Copyright (C) 2012-2013 OpenWrt.org
. /lib/functions/leds.sh
status_led="power"
set_state() {
[ -d /sys/class/leds/power2/ ] && {
case "$1" in
preinit)
led_set_attr "power2" "trigger" "heartbeat"
;;
init)
status_led_on
;;
failsafe)
led_off "power2"
status_led_set_timer 100 100
;;
done)
led_off "power2"
;;
esac
return
}
case "$1" in
preinit)
status_led_set_heartbeat
;;
failsafe)
[ -d /sys/class/leds/power1 ] && {
status_led_off
led_timer "power1" 100 100
} || status_led_set_timer 100 100
;;
done)
status_led_on
led_off "power1"
;;
esac
}