|
|
@ -2,49 +2,53 @@ |
|
|
|
# Copyright (C) 2012-2013 OpenWrt.org |
|
|
|
# Copyright (C) 2012-2013 OpenWrt.org |
|
|
|
|
|
|
|
|
|
|
|
. /lib/functions/leds.sh |
|
|
|
. /lib/functions/leds.sh |
|
|
|
|
|
|
|
. /lib/functions/lantiq.sh |
|
|
|
|
|
|
|
|
|
|
|
status_led=power |
|
|
|
power="$(lantiq_get_dt_led_chosen power)" |
|
|
|
[ ! -d /sys/class/leds/power/ ] && [ ! -d /sys/class/leds/power1/ ] && [ ! -d /sys/class/leds/power2/ ] && [ -d /sys/class/leds/wps/ ] && status_led=wps |
|
|
|
power1="$(lantiq_get_dt_led_chosen power1)" |
|
|
|
|
|
|
|
power2="$(lantiq_get_dt_led_chosen power2)" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
status_led="$power" |
|
|
|
|
|
|
|
|
|
|
|
set_state() { |
|
|
|
set_state() { |
|
|
|
case "$1" in |
|
|
|
case "$1" in |
|
|
|
preinit) |
|
|
|
preinit) |
|
|
|
if [ -d /sys/class/leds/power2/ ]; then |
|
|
|
if [ -n "$power2" ]; then |
|
|
|
status_led_on |
|
|
|
status_led_on |
|
|
|
status_led=power2 |
|
|
|
status_led="$power2" |
|
|
|
status_led_blink_preinit |
|
|
|
status_led_blink_preinit |
|
|
|
status_led=power |
|
|
|
status_led="$power" |
|
|
|
else |
|
|
|
else |
|
|
|
status_led_blink_preinit |
|
|
|
status_led_blink_preinit |
|
|
|
fi |
|
|
|
fi |
|
|
|
;; |
|
|
|
;; |
|
|
|
failsafe) |
|
|
|
failsafe) |
|
|
|
if [ -d /sys/class/leds/power2/ ]; then |
|
|
|
if [ -n "$power2" ]; then |
|
|
|
led_off power2 |
|
|
|
led_off "$power2" |
|
|
|
status_led_blink_failsafe |
|
|
|
status_led_blink_failsafe |
|
|
|
elif [ -d /sys/class/leds/power1/ ]; then |
|
|
|
elif [ -n "$power1" ]; then |
|
|
|
status_led_off |
|
|
|
status_led_off |
|
|
|
status_led=power1 |
|
|
|
status_led="$power1" |
|
|
|
status_led_blink_failsafe |
|
|
|
status_led_blink_failsafe |
|
|
|
status_led=power |
|
|
|
status_led="$power" |
|
|
|
else |
|
|
|
else |
|
|
|
status_led_blink_failsafe |
|
|
|
status_led_blink_failsafe |
|
|
|
fi |
|
|
|
fi |
|
|
|
;; |
|
|
|
;; |
|
|
|
preinit_regular) |
|
|
|
preinit_regular) |
|
|
|
if [ -d /sys/class/leds/power2/ ]; then |
|
|
|
if [ -n "$power2" ]; then |
|
|
|
status_led_on |
|
|
|
status_led_on |
|
|
|
status_led=power2 |
|
|
|
status_led="$power2" |
|
|
|
status_led_blink_preinit_regular |
|
|
|
status_led_blink_preinit_regular |
|
|
|
status_led=power |
|
|
|
status_led="$power" |
|
|
|
else |
|
|
|
else |
|
|
|
status_led_blink_preinit_regular |
|
|
|
status_led_blink_preinit_regular |
|
|
|
fi |
|
|
|
fi |
|
|
|
;; |
|
|
|
;; |
|
|
|
done) |
|
|
|
done) |
|
|
|
status_led_on |
|
|
|
status_led_on |
|
|
|
led_off power1 |
|
|
|
led_off "$power1" |
|
|
|
led_off power2 |
|
|
|
led_off "$power2" |
|
|
|
;; |
|
|
|
;; |
|
|
|
esac |
|
|
|
esac |
|
|
|
} |
|
|
|
} |
|
|
|