Skip to content

Commit fb06163

Browse files
committed
gluon-setup-mode: provide LED feedback for setup-mode activation
This adds a fast-blink animation when Gluon started the procedure to enter setup mode. This is helpful, as some devices might not provide feedback by the status LED on reboot. This can lead to unwanted activation of a bootloader recovery procedure. Signed-off-by: David Bauer <mail@david-bauer.net>
1 parent 4afdc22 commit fb06163

3 files changed

Lines changed: 39 additions & 23 deletions

File tree

package/gluon-setup-mode/files/etc/hotplug.d/button/50-gluon-setup-mode

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ wait=3
66

77
wait_setup_mode() {
88
sleep $wait
9+
/lib/gluon/setup-mode/led.sh confirm
910
gluon-enter-setup-mode
1011
}
1112

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
3+
# shellcheck disable=SC1091,SC2154
4+
5+
get_setup_mode_led() {
6+
. /etc/diag.sh
7+
get_status_led 2> /dev/null
8+
9+
if [ -z "$status_led" ]; then
10+
status_led="$running"
11+
fi
12+
13+
if [ -z "$status_led" ]; then
14+
status_led="$boot"
15+
fi
16+
17+
custom_led="$(lua -e 'print(require("gluon.setup-mode").get_status_led() or "")')"
18+
if [ -z "$status_led" ]; then
19+
status_led="$custom_led"
20+
fi
21+
}
22+
23+
MODE="$1"
24+
case "$mode" in
25+
confirm)
26+
get_setup_mode_led 2> /dev/null
27+
status_led_set_timer 100 100
28+
;;
29+
running)
30+
get_setup_mode_led 2> /dev/null
31+
status_led_set_timer 1000 300
32+
;;
33+
*)
34+
echo "Usage: $0 <running|confirm>"
35+
exit 1
36+
;;
37+
esac
Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,8 @@
11
#!/bin/sh /etc/rc.common
22

3-
# shellcheck disable=SC1091,SC2154
4-
53
START=96
64

75
start() {
8-
local custom_led
9-
106
/etc/init.d/led start
11-
12-
. /etc/diag.sh
13-
14-
get_status_led 2> /dev/null
15-
16-
if [ -z "$status_led" ]; then
17-
status_led="$running"
18-
fi
19-
20-
if [ -z "$status_led" ]; then
21-
status_led="$boot"
22-
fi
23-
24-
custom_led="$(lua -e 'print(require("gluon.setup-mode").get_status_led() or "")')"
25-
if [ -z "$status_led" ]; then
26-
status_led="$custom_led"
27-
fi
28-
29-
status_led_set_timer 1000 300
7+
/lib/gluon/setup-mode/led.sh running
308
}

0 commit comments

Comments
 (0)