mirror of https://github.com/hak5/openwrt.git
ath79: add support for indicating the boot state using multiple leds
Use diag.sh version used for apm821xx, ipq40xx and ipq806x, which supports different leds for the different boot states. The existing led sequences should be the same as before. Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com> [reword commit message] Signed-off-by: Mathias Kresin <dev@kresin.me>openwrt-19.07
parent
37af596593
commit
7a873974f7
|
@ -2,21 +2,46 @@
|
|||
|
||||
. /lib/functions/leds.sh
|
||||
|
||||
status_led="$(get_dt_led status)"
|
||||
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_on
|
||||
status_led_off
|
||||
[ -n "$running" ] && {
|
||||
status_led="$running"
|
||||
status_led_on
|
||||
}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
model = "D-Link DIR825B1";
|
||||
|
||||
aliases {
|
||||
led-status = &orange_power;
|
||||
led-boot = &orange_power;
|
||||
led-failsafe = &orange_power;
|
||||
led-running = &orange_power;
|
||||
led-upgrade = &orange_power;
|
||||
};
|
||||
|
||||
chosen {
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
|
||||
/ {
|
||||
aliases {
|
||||
led-status = &power_green;
|
||||
led-boot = &power_green;
|
||||
led-failsafe = &power_green;
|
||||
led-running = &power_green;
|
||||
led-upgrade = &power_green;
|
||||
};
|
||||
|
||||
chosen {
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
model = "Netgear WNR612 V2";
|
||||
|
||||
aliases {
|
||||
led-status = &led_power;
|
||||
led-boot = &power;
|
||||
led-failsafe = &power;
|
||||
led-running = &power;
|
||||
led-upgrade = &power;
|
||||
};
|
||||
|
||||
gpio-keys-polled {
|
||||
|
@ -28,7 +31,7 @@
|
|||
|
||||
gpio-leds {
|
||||
compatible = "gpio-leds";
|
||||
led_power: power {
|
||||
power: power {
|
||||
label = "netgear:green:power";
|
||||
gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
|
||||
/ {
|
||||
aliases {
|
||||
led-status = &led_system;
|
||||
led-boot = &led_system;
|
||||
led-failsafe = &led_system;
|
||||
led-running = &led_system;
|
||||
led-upgrade = &led_system;
|
||||
};
|
||||
|
||||
gpio-keys-polled {
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
|
||||
/ {
|
||||
aliases {
|
||||
led-status = &led_system;
|
||||
led-boot = &led_system;
|
||||
led-failsafe = &led_system;
|
||||
led-running = &led_system;
|
||||
led-upgrade = &led_system;
|
||||
};
|
||||
|
||||
gpio-keys-polled {
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
model = "Ubiquiti UniFi AP";
|
||||
|
||||
aliases {
|
||||
led-status = &dome_green;
|
||||
led-boot = &dome_green;
|
||||
led-failsafe = &dome_green;
|
||||
led-running = &dome_green;
|
||||
led-upgrade = &dome_green;
|
||||
};
|
||||
|
||||
extosc: ref {
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
model = "AVM FRITZ!WLAN Repeater 300E";
|
||||
|
||||
aliases {
|
||||
led-status = &power;
|
||||
led-boot = &power;
|
||||
led-failsafe = &power;
|
||||
led-running = &power;
|
||||
led-upgrade = &power;
|
||||
};
|
||||
|
||||
gpio-keys {
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
model = "TP-LINK TL-WR2543N/ND";
|
||||
|
||||
aliases {
|
||||
led-status = &system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
};
|
||||
|
||||
chosen {
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
model = "TP-Link TL-WR1043ND Version 1";
|
||||
|
||||
aliases {
|
||||
led-status = &system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
};
|
||||
|
||||
extosc: ref {
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
model = "TP-Link TL-WR941N/ND v2/v3";
|
||||
|
||||
aliases {
|
||||
led-status = &led_system;
|
||||
led-boot = &led_system;
|
||||
led-failsafe = &led_system;
|
||||
led-running = &led_system;
|
||||
led-upgrade = &led_system;
|
||||
};
|
||||
|
||||
keys {
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
|
||||
aliases {
|
||||
serial0 = &uart;
|
||||
led-status = &wlan;
|
||||
led-boot = &wlan;
|
||||
led-failsafe = &wlan;
|
||||
led-upgrade = &wlan;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
compatible = "embeddedwireless,dorin", "qca,ar9331";
|
||||
|
||||
aliases {
|
||||
led-status = &status;
|
||||
led-boot = &status;
|
||||
led-failsafe = &status;
|
||||
led-running = &status;
|
||||
led-upgrade = &status;
|
||||
serial0 = &uart;
|
||||
};
|
||||
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
|
||||
aliases {
|
||||
serial0 = &uart;
|
||||
led-status = &led_system;
|
||||
led-boot = &led_system;
|
||||
led-failsafe = &led_system;
|
||||
led-running = &led_system;
|
||||
led-upgrade = &led_system;
|
||||
};
|
||||
|
||||
gpio-keys-polled {
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
|
||||
aliases {
|
||||
serial0 = &uart;
|
||||
led-status = &system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
/ {
|
||||
aliases {
|
||||
serial0 = &uart;
|
||||
led-status = &led_system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
};
|
||||
|
||||
gpio-keys-polled {
|
||||
|
@ -27,7 +30,7 @@
|
|||
gpio-leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
led_system: system {
|
||||
system: system {
|
||||
label = "tl-wr703n:blue:system";
|
||||
gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
|
||||
aliases {
|
||||
serial0 = &uart;
|
||||
led-status = &led_system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
};
|
||||
|
||||
gpio-keys-polled {
|
||||
|
@ -64,7 +67,7 @@
|
|||
gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
led_system: system {
|
||||
system: system {
|
||||
label = "tp-link:green:system";
|
||||
gpios = <&gpio 27 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
|
||||
aliases {
|
||||
serial0 = &uart;
|
||||
led-status = &status;
|
||||
led-boot = &status;
|
||||
led-failsafe = &status;
|
||||
led-running = &status;
|
||||
led-upgrade = &status;
|
||||
};
|
||||
|
||||
keys {
|
||||
|
|
|
@ -15,7 +15,10 @@
|
|||
};
|
||||
|
||||
aliases {
|
||||
led-status = &system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
|
||||
aliases {
|
||||
serial0 = &uart;
|
||||
led-status = &status;
|
||||
led-boot = &status;
|
||||
led-failsafe = &status;
|
||||
led-running = &status;
|
||||
led-upgrade = &status;
|
||||
};
|
||||
|
||||
keys {
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
|
||||
aliases {
|
||||
serial0 = &uart;
|
||||
led-status = &status;
|
||||
led-boot = &status;
|
||||
led-failsafe = &status;
|
||||
led-running = &status;
|
||||
led-upgrade = &status;
|
||||
};
|
||||
|
||||
keys {
|
||||
|
|
|
@ -10,7 +10,10 @@
|
|||
compatible = "tplink,tl-wdr4300";
|
||||
|
||||
aliases {
|
||||
led-status = &system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
model = "TP-Link TL-WR841N/ND Version 11";
|
||||
|
||||
aliases {
|
||||
led-status = &system_led;
|
||||
led-boot = &system_led;
|
||||
led-failsafe = &system_led;
|
||||
led-running = &system_led;
|
||||
led-upgrade = &system_led;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
model = "TP-Link TL-WR841N/ND Version 9";
|
||||
|
||||
aliases {
|
||||
led-status = &qss_led;
|
||||
led-boot = &qss_led;
|
||||
led-failsafe = &qss_led;
|
||||
led-running = &qss_led;
|
||||
led-upgrade = &qss_led;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
model = "I-O DATA WN-AC1600DGR2";
|
||||
|
||||
aliases {
|
||||
led-status = &power;
|
||||
led-boot = &power;
|
||||
led-failsafe = &power;
|
||||
led-running = &power;
|
||||
led-upgrade = &power;
|
||||
};
|
||||
|
||||
chosen {
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
model = "Buffalo BHR-4GRV2";
|
||||
|
||||
aliases {
|
||||
led-status = &power;
|
||||
led-boot = &power;
|
||||
led-failsafe = &power;
|
||||
led-running = &power;
|
||||
led-upgrade = &power;
|
||||
};
|
||||
|
||||
chosen {
|
||||
|
|
|
@ -15,7 +15,10 @@
|
|||
};
|
||||
|
||||
aliases {
|
||||
led-status = &system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
};
|
||||
|
||||
aliases {
|
||||
led-status = &system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
};
|
||||
|
||||
gpio_leds: leds {
|
||||
|
|
|
@ -15,7 +15,10 @@
|
|||
};
|
||||
|
||||
aliases {
|
||||
led-status = &led_system;
|
||||
led-boot = &led_system;
|
||||
led-failsafe = &led_system;
|
||||
led-running = &led_system;
|
||||
led-upgrade = &led_system;
|
||||
};
|
||||
|
||||
gpio_leds: leds {
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
};
|
||||
|
||||
aliases {
|
||||
led-status = &system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
};
|
||||
|
||||
leds {
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
compatible = "phicomm,k2t";
|
||||
|
||||
aliases {
|
||||
led-status = &status_red;
|
||||
led-boot = &status_red;
|
||||
led-failsafe = &status_red;
|
||||
led-running = &status_red;
|
||||
led-upgrade = &status_red;
|
||||
};
|
||||
|
||||
chosen {
|
||||
|
|
|
@ -15,7 +15,10 @@
|
|||
};
|
||||
|
||||
aliases {
|
||||
led-status = &system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
mdio-gpio0 = &mdio2;
|
||||
};
|
||||
|
||||
|
|
|
@ -12,7 +12,10 @@
|
|||
};
|
||||
|
||||
aliases {
|
||||
led-status = &system;
|
||||
led-boot = &system;
|
||||
led-failsafe = &system;
|
||||
led-running = &system;
|
||||
led-upgrade = &system;
|
||||
};
|
||||
|
||||
gpio_leds: leds {
|
||||
|
|
Loading…
Reference in New Issue