aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2016-01-01 21:18:30 +0000
committerJohn Crispin <blogic@openwrt.org>2016-01-01 21:18:30 +0000
commit8eb07b4af7c259e2bc624daa8979b81f33195ffd (patch)
tree5103812b998a8551f35a8dbbc9cb42bc57938543 /target/linux
parentc9546b7f38639432cff5627b73cfa7dd301f66eb (diff)
downloadmaster-187ad058-8eb07b4af7c259e2bc624daa8979b81f33195ffd.tar.gz
master-187ad058-8eb07b4af7c259e2bc624daa8979b81f33195ffd.tar.bz2
master-187ad058-8eb07b4af7c259e2bc624daa8979b81f33195ffd.zip
lantiq: use power leds defined in DTS
Use the power leds defined in the dts file instead of hardcoded led names. Signed-off-by: Mathias Kresin <openwrt@kresin.me> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48039 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/lantiq/base-files/etc/diag.sh34
1 files changed, 19 insertions, 15 deletions
diff --git a/target/linux/lantiq/base-files/etc/diag.sh b/target/linux/lantiq/base-files/etc/diag.sh
index 57a7055127..0e65e6133b 100644
--- a/target/linux/lantiq/base-files/etc/diag.sh
+++ b/target/linux/lantiq/base-files/etc/diag.sh
@@ -2,49 +2,53 @@
# Copyright (C) 2012-2013 OpenWrt.org
. /lib/functions/leds.sh
+. /lib/functions/lantiq.sh
-status_led=power
-[ ! -d /sys/class/leds/power/ ] && [ ! -d /sys/class/leds/power1/ ] && [ ! -d /sys/class/leds/power2/ ] && [ -d /sys/class/leds/wps/ ] && status_led=wps
+power="$(lantiq_get_dt_led_chosen power)"
+power1="$(lantiq_get_dt_led_chosen power1)"
+power2="$(lantiq_get_dt_led_chosen power2)"
+
+status_led="$power"
set_state() {
case "$1" in
preinit)
- if [ -d /sys/class/leds/power2/ ]; then
+ if [ -n "$power2" ]; then
status_led_on
- status_led=power2
+ status_led="$power2"
status_led_blink_preinit
- status_led=power
+ status_led="$power"
else
status_led_blink_preinit
fi
;;
failsafe)
- if [ -d /sys/class/leds/power2/ ]; then
- led_off power2
+ if [ -n "$power2" ]; then
+ led_off "$power2"
status_led_blink_failsafe
- elif [ -d /sys/class/leds/power1/ ]; then
+ elif [ -n "$power1" ]; then
status_led_off
- status_led=power1
+ status_led="$power1"
status_led_blink_failsafe
- status_led=power
+ status_led="$power"
else
status_led_blink_failsafe
fi
;;
preinit_regular)
- if [ -d /sys/class/leds/power2/ ]; then
+ if [ -n "$power2" ]; then
status_led_on
- status_led=power2
+ status_led="$power2"
status_led_blink_preinit_regular
- status_led=power
+ status_led="$power"
else
status_led_blink_preinit_regular
fi
;;
done)
status_led_on
- led_off power1
- led_off power2
+ led_off "$power1"
+ led_off "$power2"
;;
esac
}