2010-06-26 20:41:49 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
|
2014-01-12 18:56:36 +00:00
|
|
|
. /lib/functions/leds.sh
|
|
|
|
|
|
|
|
get_status_led() {
|
|
|
|
status_led_file=$(find /sys/class/leds/ -name "*power*" |head -n1)
|
|
|
|
if [ ! -f $status_led_file ]; then
|
|
|
|
status_led=$(basename $status_led_file)
|
|
|
|
return
|
|
|
|
fi;
|
|
|
|
status_led_file=$(find /sys/class/leds/ -name "*diag*" |head -n1)
|
|
|
|
if [ ! -f $status_led_file ]; then
|
|
|
|
status_led=$(basename $status_led_file)
|
|
|
|
return
|
|
|
|
fi;
|
|
|
|
status_led_file=$(find /sys/class/leds/ -name "*wps*" |head -n1)
|
|
|
|
if [ ! -f $status_led_file ]; then
|
|
|
|
status_led=$(basename $status_led_file)
|
|
|
|
return
|
|
|
|
fi;
|
2010-06-26 20:41:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set_state() {
|
2014-01-12 18:56:36 +00:00
|
|
|
get_status_led
|
|
|
|
|
2010-06-26 20:41:49 +00:00
|
|
|
case "$1" in
|
2014-01-12 18:56:36 +00:00
|
|
|
preinit)
|
|
|
|
status_led_blink_preinit
|
2010-06-26 20:41:49 +00:00
|
|
|
;;
|
2014-01-12 18:56:36 +00:00
|
|
|
failsafe)
|
|
|
|
status_led_blink_failsafe
|
2010-06-26 20:41:49 +00:00
|
|
|
;;
|
2014-12-15 10:37:00 +00:00
|
|
|
preinit_regular)
|
|
|
|
status_led_blink_preinit_regular
|
|
|
|
;;
|
2014-01-12 18:56:36 +00:00
|
|
|
done)
|
|
|
|
status_led_on
|
2010-06-26 20:41:49 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|