diff mbox

[OpenWrt-Devel,1/3] lantiq: use the configured dsl led instead of a hardcoded one

Message ID 1450308368-20406-1-git-send-email-openwrt@kresin.me
State Under Review, archived
Delegated to: Mathias Kresin
Headers show

Commit Message

Mathias Kresin Dec. 16, 2015, 11:26 p.m. UTC
Signed-off-by: Mathias Kresin <openwrt@kresin.me>
---
 target/linux/lantiq/base-files/etc/board.d/01_leds |  1 +
 target/linux/lantiq/base-files/sbin/dsl_notify.sh  | 14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/target/linux/lantiq/base-files/etc/board.d/01_leds b/target/linux/lantiq/base-files/etc/board.d/01_leds
index b5801ca..8422ec0 100755
--- a/target/linux/lantiq/base-files/etc/board.d/01_leds
+++ b/target/linux/lantiq/base-files/etc/board.d/01_leds
@@ -12,6 +12,7 @@  board_config_update
 [ -e "/sys/class/leds/wifi" ] && ucidef_set_led_wlan "wifi" "wifi" "wifi" "phy0tpt"
 [ -e "/sys/class/leds/usb" ] && ucidef_set_led_usbdev "usb" "usb" "usb" "1-1"
 [ -e "/sys/class/leds/usb2" ] && ucidef_set_led_usbdev "usb2" "usb2" "usb2" "2-1"
+[ -e "/sys/class/leds/dsl" ] && ucidef_set_led_default "dsl" "dsl" "dsl" "0"
 [ -e "/sys/class/leds/internet" ] && ucidef_set_led_netdev "internet" "internet" "internet" "pppoe-wan"
 
 board=$(lantiq_board_name)
diff --git a/target/linux/lantiq/base-files/sbin/dsl_notify.sh b/target/linux/lantiq/base-files/sbin/dsl_notify.sh
index b514e25..01d0488 100755
--- a/target/linux/lantiq/base-files/sbin/dsl_notify.sh
+++ b/target/linux/lantiq/base-files/sbin/dsl_notify.sh
@@ -16,15 +16,15 @@ 
 include /lib/network
 scan_interfaces
 
-local default
+local led
 config_load system
-config_get default led_adsl default
-if [ "$default" != 1 ]; then
+config_get led led_dsl sysfs
+if [ -n "$led" ]; then
 	case "$DSL_INTERFACE_STATUS" in
-	  "HANDSHAKE")  led_timer dsl 500 500;;
-	  "TRAINING")   led_timer dsl 200 200;;
-	  "UP")		led_on dsl;;
-	  *)		led_off dsl
+	  "HANDSHAKE")  led_timer $led 500 500;;
+	  "TRAINING")   led_timer $led 200 200;;
+	  "UP")		led_on $led;;
+	  *)		led_off $led
 	esac
 fi