lantiq: Fix LED handling.
- Use common OpenWrt blink patterns instead of custom ones - Add preinit_regular hook - Handle the TDW89X0 that does not have a configurable power LED Signed-off-by: Vittorio Gambaletta <openwrt@vittgam.net> SVN-Revision: 47914
This commit is contained in:
parent
34934609f9
commit
ab77d4bcb9
1 changed files with 32 additions and 24 deletions
|
@ -3,40 +3,48 @@
|
||||||
|
|
||||||
. /lib/functions/leds.sh
|
. /lib/functions/leds.sh
|
||||||
|
|
||||||
status_led="power"
|
status_led=power
|
||||||
|
[ ! -d /sys/class/leds/power/ ] && [ ! -d /sys/class/leds/power1/ ] && [ ! -d /sys/class/leds/power2/ ] && [ -d /sys/class/leds/wps/ ] && status_led=wps
|
||||||
|
|
||||||
set_state() {
|
set_state() {
|
||||||
[ -d /sys/class/leds/power2/ ] && {
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
preinit)
|
preinit)
|
||||||
led_set_attr "power2" "trigger" "heartbeat"
|
if [ -d /sys/class/leds/power2/ ]; then
|
||||||
status_led_on
|
status_led_on
|
||||||
|
status_led=power2
|
||||||
|
status_led_blink_preinit
|
||||||
|
status_led=power
|
||||||
|
else
|
||||||
|
status_led_blink_preinit
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
failsafe)
|
failsafe)
|
||||||
led_off "power2"
|
if [ -d /sys/class/leds/power2/ ]; then
|
||||||
status_led_set_timer 100 100
|
led_off power2
|
||||||
;;
|
status_led_blink_failsafe
|
||||||
done)
|
elif [ -d /sys/class/leds/power1/ ]; then
|
||||||
led_off "power2"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
preinit)
|
|
||||||
status_led_set_heartbeat
|
|
||||||
;;
|
|
||||||
failsafe)
|
|
||||||
[ -d /sys/class/leds/power1 ] && {
|
|
||||||
status_led_off
|
status_led_off
|
||||||
led_timer "power1" 100 100
|
status_led=power1
|
||||||
} || status_led_set_timer 100 100
|
status_led_blink_failsafe
|
||||||
|
status_led=power
|
||||||
|
else
|
||||||
|
status_led_blink_failsafe
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
preinit_regular)
|
||||||
|
if [ -d /sys/class/leds/power2/ ]; then
|
||||||
|
status_led_on
|
||||||
|
status_led=power2
|
||||||
|
status_led_blink_preinit_regular
|
||||||
|
status_led=power
|
||||||
|
else
|
||||||
|
status_led_blink_preinit_regular
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
done)
|
done)
|
||||||
status_led_on
|
status_led_on
|
||||||
led_off "power1"
|
led_off power1
|
||||||
|
led_off power2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue