lantiq: split up dsl_notify.sh into separate notification handlers
[openwrt/staging/dedeckeh.git] / target / linux / lantiq / base-files / etc / hotplug.d / dsl / led_dsl.sh
1 #!/bin/sh
2
3 [ "$DSL_NOTIFICATION_TYPE" = "DSL_INTERFACE_STATUS" ] || exit 0
4
5 . /lib/functions.sh
6 . /lib/functions/leds.sh
7
8 led_dsl_up() {
9 case "$(config_get led_dsl trigger)" in
10 "netdev")
11 led_set_attr $1 "trigger" "netdev"
12 led_set_attr $1 "device_name" "$(config_get led_dsl dev)"
13 led_set_attr $1 "mode" "$(config_get led_dsl mode)"
14 ;;
15 *)
16 led_on $1
17 ;;
18 esac
19 }
20
21 config_load system
22 config_get led led_dsl sysfs
23 if [ -n "$led" ]; then
24 case "$DSL_INTERFACE_STATUS" in
25 "HANDSHAKE") led_timer $led 500 500;;
26 "TRAINING") led_timer $led 200 200;;
27 "UP") led_dsl_up $led;;
28 *) led_off $led
29 esac
30 fi