mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 14:37:57 +00:00
4fc005197a
This commit adds the get_status_led method to diag.sh, which sets the boot-led as status-led for scripts using this method to get a status-led. This method is used platform-independent in downstream project gluon to set the LED used to indicate the config-mode. Signed-off-by: David Bauer <mail@david-bauer.net>
48 lines
724 B
Bash
Executable File
48 lines
724 B
Bash
Executable File
#!/bin/sh
|
|
|
|
. /lib/functions/leds.sh
|
|
|
|
boot="$(get_dt_led boot)"
|
|
failsafe="$(get_dt_led failsafe)"
|
|
running="$(get_dt_led running)"
|
|
upgrade="$(get_dt_led upgrade)"
|
|
|
|
get_status_led() {
|
|
status_led="$boot"
|
|
}
|
|
|
|
set_state() {
|
|
status_led="$boot"
|
|
|
|
case "$1" in
|
|
preinit)
|
|
status_led_blink_preinit
|
|
;;
|
|
failsafe)
|
|
status_led_off
|
|
[ -n "$running" ] && {
|
|
status_led="$running"
|
|
status_led_off
|
|
}
|
|
status_led="$failsafe"
|
|
status_led_blink_failsafe
|
|
;;
|
|
preinit_regular)
|
|
status_led_blink_preinit_regular
|
|
;;
|
|
upgrade)
|
|
[ -n "$running" ] && {
|
|
status_led="$upgrade"
|
|
status_led_blink_preinit_regular
|
|
}
|
|
;;
|
|
done)
|
|
status_led_off
|
|
[ -n "$running" ] && {
|
|
status_led="$running"
|
|
status_led_on
|
|
}
|
|
;;
|
|
esac
|
|
}
|