treewide: fix upgrade led handling
authorMathias Kresin <dev@kresin.me>
Wed, 15 Aug 2018 17:12:27 +0000 (19:12 +0200)
committerMathias Kresin <dev@kresin.me>
Thu, 16 Aug 2018 19:20:57 +0000 (21:20 +0200)
The upgrade led is only used if a running led is defined. If no running
led is defined, the upgrade led is ignored and upgrade isn't indicated
at all.

Instead, turn off the running led prior to turning the upgrade led on.
In most cases there isn't any visual change, but it allows to use an
independent led for upgrade indication.

Signed-off-by: Mathias Kresin <dev@kresin.me>
target/linux/apm821xx/base-files/etc/diag.sh
target/linux/ath79/base-files/etc/diag.sh
target/linux/ipq40xx/base-files/etc/diag.sh
target/linux/ipq806x/base-files/etc/diag.sh

index 26c035c6f3f3aeffbb1c5efbf4fb2f242f94720f..96d42a48923ced4e8a3b8edadb8ff22c17b39520 100755 (executable)
@@ -29,9 +29,11 @@ set_state() {
                ;;
        upgrade)
                [ -n "$running" ] && {
-                       status_led="$upgrade"
-                       status_led_blink_preinit_regular
+                       status_led="$running"
+                       status_led_off
                }
+               status_led="$upgrade"
+               status_led_blink_preinit_regular
                ;;
        done)
                status_led_off
index a3a70477024ff4e51e110b7d0566019ad71e1899..782bab907af212260fc071b5aa67bdf321b33659 100755 (executable)
@@ -32,9 +32,11 @@ set_state() {
                ;;
        upgrade)
                [ -n "$running" ] && {
-                       status_led="$upgrade"
-                       status_led_blink_preinit_regular
+                       status_led="$running"
+                       status_led_off
                }
+               status_led="$upgrade"
+               status_led_blink_preinit_regular
                ;;
        done)
                status_led_off
index a3a70477024ff4e51e110b7d0566019ad71e1899..782bab907af212260fc071b5aa67bdf321b33659 100755 (executable)
@@ -32,9 +32,11 @@ set_state() {
                ;;
        upgrade)
                [ -n "$running" ] && {
-                       status_led="$upgrade"
-                       status_led_blink_preinit_regular
+                       status_led="$running"
+                       status_led_off
                }
+               status_led="$upgrade"
+               status_led_blink_preinit_regular
                ;;
        done)
                status_led_off
index df4afd936caefb1625121122ff1fb2b53774895f..9e6b4918ed7cce3f4b16a6ccb177ac9400163d25 100755 (executable)
@@ -29,9 +29,11 @@ set_state() {
                ;;
        upgrade)
                [ -n "$running" ] && {
-                       status_led="$upgrade"
-                       status_led_blink_preinit_regular
+                       status_led="$running"
+                       status_led_off
                }
+               status_led="$upgrade"
+               status_led_blink_preinit_regular
                ;;
        done)
                status_led_off