2012-12-15 02:01:00 +00:00
|
|
|
#!/bin/sh
|
2013-04-03 10:01:07 +00:00
|
|
|
# Copyright (C) 2012-2013 OpenWrt.org
|
2012-12-15 02:01:00 +00:00
|
|
|
|
2013-04-03 10:01:07 +00:00
|
|
|
. /lib/functions/leds.sh
|
2016-01-01 21:18:30 +00:00
|
|
|
. /lib/functions/lantiq.sh
|
2012-12-15 02:01:00 +00:00
|
|
|
|
2016-01-01 21:18:30 +00:00
|
|
|
power="$(lantiq_get_dt_led_chosen power)"
|
|
|
|
power1="$(lantiq_get_dt_led_chosen power1)"
|
|
|
|
power2="$(lantiq_get_dt_led_chosen power2)"
|
|
|
|
|
|
|
|
status_led="$power"
|
2012-12-15 02:01:00 +00:00
|
|
|
|
2013-04-03 10:01:07 +00:00
|
|
|
set_state() {
|
2012-12-15 02:01:00 +00:00
|
|
|
case "$1" in
|
|
|
|
preinit)
|
2016-01-01 21:18:30 +00:00
|
|
|
if [ -n "$power2" ]; then
|
2015-12-17 09:27:52 +00:00
|
|
|
status_led_on
|
2016-01-01 21:18:30 +00:00
|
|
|
status_led="$power2"
|
2015-12-17 09:27:52 +00:00
|
|
|
status_led_blink_preinit
|
2016-01-01 21:18:30 +00:00
|
|
|
status_led="$power"
|
2015-12-17 09:27:52 +00:00
|
|
|
else
|
|
|
|
status_led_blink_preinit
|
|
|
|
fi
|
2012-12-15 02:01:00 +00:00
|
|
|
;;
|
|
|
|
failsafe)
|
2016-01-01 21:18:30 +00:00
|
|
|
if [ -n "$power2" ]; then
|
|
|
|
led_off "$power2"
|
2015-12-17 09:27:52 +00:00
|
|
|
status_led_blink_failsafe
|
2016-01-01 21:18:30 +00:00
|
|
|
elif [ -n "$power1" ]; then
|
2013-04-03 10:01:07 +00:00
|
|
|
status_led_off
|
2016-01-01 21:18:30 +00:00
|
|
|
status_led="$power1"
|
2015-12-17 09:27:52 +00:00
|
|
|
status_led_blink_failsafe
|
2016-01-01 21:18:30 +00:00
|
|
|
status_led="$power"
|
2015-12-17 09:27:52 +00:00
|
|
|
else
|
|
|
|
status_led_blink_failsafe
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
preinit_regular)
|
2016-01-01 21:18:30 +00:00
|
|
|
if [ -n "$power2" ]; then
|
2015-12-17 09:27:52 +00:00
|
|
|
status_led_on
|
2016-01-01 21:18:30 +00:00
|
|
|
status_led="$power2"
|
2015-12-17 09:27:52 +00:00
|
|
|
status_led_blink_preinit_regular
|
2016-01-01 21:18:30 +00:00
|
|
|
status_led="$power"
|
2015-12-17 09:27:52 +00:00
|
|
|
else
|
|
|
|
status_led_blink_preinit_regular
|
|
|
|
fi
|
2012-12-15 02:01:00 +00:00
|
|
|
;;
|
|
|
|
done)
|
2013-04-03 10:01:07 +00:00
|
|
|
status_led_on
|
2016-01-01 21:18:30 +00:00
|
|
|
led_off "$power1"
|
|
|
|
led_off "$power2"
|
2012-12-15 02:01:00 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|