2010-06-27 04:41:49 +08:00
|
|
|
#!/bin/sh
|
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
|
2014-01-13 02:56:36 +08: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-27 04:41:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
set_state() {
|
2014-01-13 02:56:36 +08:00
|
|
|
get_status_led
|
|
|
|
|
2010-06-27 04:41:49 +08:00
|
|
|
case "$1" in
|
2014-01-13 02:56:36 +08:00
|
|
|
preinit)
|
|
|
|
status_led_blink_preinit
|
2010-06-27 04:41:49 +08:00
|
|
|
;;
|
2014-01-13 02:56:36 +08:00
|
|
|
failsafe)
|
|
|
|
status_led_blink_failsafe
|
2010-06-27 04:41:49 +08:00
|
|
|
;;
|
2014-01-13 02:56:36 +08:00
|
|
|
done)
|
|
|
|
status_led_on
|
2010-06-27 04:41:49 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|