mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-27 22:59:53 +00:00
551c9c8300
This patch is a follow up to commit 4cf3fd4 "add support for indicating the boot state using three leds". At the time of writing the patch, I wasn't aware that it's possible to switch info failsafe after boot (factory reset). Enabling the failsafe led without disabling the running led causes an unexpected led colour on devices using a single multicolour led to indicate the boot state. Signed-off-by: Mathias Kresin <dev@kresin.me>
39 lines
655 B
Bash
39 lines
655 B
Bash
#!/bin/sh
|
|
# Copyright (C) 2010-2015 OpenWrt.org
|
|
|
|
. /lib/functions/leds.sh
|
|
. /lib/functions/lantiq.sh
|
|
|
|
boot="$(lantiq_get_dt_led_chosen boot)"
|
|
failsafe="$(lantiq_get_dt_led_chosen failsafe)"
|
|
running="$(lantiq_get_dt_led_chosen running)"
|
|
|
|
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
|
|
;;
|
|
done)
|
|
status_led_off
|
|
[ -n "$running" ] && {
|
|
status_led="$running"
|
|
status_led_on
|
|
}
|
|
;;
|
|
esac
|
|
}
|