2015-02-14 20:48:08 +00:00
|
|
|
#!/bin/sh
|
2016-03-08 18:11:55 +00:00
|
|
|
# Copyright (C) 2015-2016 OpenWrt.org
|
2017-03-05 20:16:06 +00:00
|
|
|
# Copyright (C) 2017 LEDE project
|
2015-02-14 20:48:08 +00:00
|
|
|
|
2017-05-12 20:36:07 +00:00
|
|
|
. /lib/functions.sh
|
2015-02-14 20:48:08 +00:00
|
|
|
. /lib/functions/leds.sh
|
|
|
|
|
2024-07-03 18:56:56 +00:00
|
|
|
status_led_restore_trigger() {
|
|
|
|
local led_lc=$(echo "$status_led" | awk '{print tolower($0)}')
|
|
|
|
local led_path="/proc/device-tree/leds/led-$led_lc"
|
|
|
|
local led_trigger
|
|
|
|
|
|
|
|
[ -d "$led_path" ] && \
|
|
|
|
led_trigger=$(cat "$led_path/linux,default-trigger" 2>/dev/null)
|
|
|
|
|
|
|
|
[ -n "$led_trigger" ] && \
|
|
|
|
led_set_attr $status_led "trigger" "$led_trigger"
|
|
|
|
}
|
|
|
|
|
2015-02-14 20:48:08 +00:00
|
|
|
set_state() {
|
2024-07-03 18:56:56 +00:00
|
|
|
if [ -d "/sys/class/leds/ACT" ]; then
|
2024-06-19 18:03:29 +00:00
|
|
|
status_led="ACT"
|
2024-07-03 18:56:56 +00:00
|
|
|
else
|
|
|
|
return
|
2024-06-19 18:03:29 +00:00
|
|
|
fi
|
2015-02-14 20:48:08 +00:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
preinit)
|
|
|
|
status_led_blink_preinit
|
|
|
|
;;
|
|
|
|
failsafe)
|
|
|
|
status_led_blink_failsafe
|
|
|
|
;;
|
|
|
|
preinit_regular)
|
|
|
|
status_led_blink_preinit_regular
|
|
|
|
;;
|
2024-07-03 18:56:56 +00:00
|
|
|
upgrade)
|
|
|
|
status_led_blink_preinit_regular
|
|
|
|
;;
|
2015-02-14 20:48:08 +00:00
|
|
|
done)
|
2024-07-03 18:56:56 +00:00
|
|
|
status_led_restore_trigger
|
2015-02-14 20:48:08 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|