2016-06-03 09:51:28 +00:00
|
|
|
#!/bin/sh
|
2016-09-30 19:36:50 +00:00
|
|
|
# Copyright (C) 2016 Henryk Heisig hyniu@o2.pl
|
2016-06-03 09:51:28 +00:00
|
|
|
|
|
|
|
. /lib/functions/leds.sh
|
|
|
|
|
2017-11-28 21:51:06 +00:00
|
|
|
boot="$(get_dt_led boot)"
|
|
|
|
failsafe="$(get_dt_led failsafe)"
|
|
|
|
running="$(get_dt_led running)"
|
|
|
|
upgrade="$(get_dt_led upgrade)"
|
2016-06-03 09:51:28 +00:00
|
|
|
|
|
|
|
set_state() {
|
2016-09-30 19:36:50 +00:00
|
|
|
status_led="$boot"
|
2016-06-03 09:51:28 +00:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
preinit)
|
|
|
|
status_led_blink_preinit
|
|
|
|
;;
|
|
|
|
failsafe)
|
2016-09-30 19:36:50 +00:00
|
|
|
status_led_off
|
|
|
|
[ -n "$running" ] && {
|
|
|
|
status_led="$running"
|
|
|
|
status_led_off
|
|
|
|
}
|
|
|
|
status_led="$failsafe"
|
2016-06-03 09:51:28 +00:00
|
|
|
status_led_blink_failsafe
|
|
|
|
;;
|
|
|
|
preinit_regular)
|
|
|
|
status_led_blink_preinit_regular
|
|
|
|
;;
|
2016-09-30 19:36:50 +00:00
|
|
|
upgrade)
|
|
|
|
[ -n "$running" ] && {
|
2018-08-15 17:12:27 +00:00
|
|
|
status_led="$running"
|
|
|
|
status_led_off
|
2016-09-30 19:36:50 +00:00
|
|
|
}
|
2018-08-15 17:12:27 +00:00
|
|
|
status_led="$upgrade"
|
|
|
|
status_led_blink_preinit_regular
|
2016-09-30 19:36:50 +00:00
|
|
|
;;
|
2016-06-03 09:51:28 +00:00
|
|
|
done)
|
2016-09-30 19:36:50 +00:00
|
|
|
status_led_off
|
|
|
|
[ -n "$running" ] && {
|
|
|
|
status_led="$running"
|
|
|
|
status_led_on
|
|
|
|
}
|
2016-06-03 09:51:28 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|