lantiq:
[openwrt.git] / target / linux / lantiq / base-files / etc / uci-defaults / leds
1 #!/bin/sh
2 #
3 # Copyright (C) 2011 OpenWrt.org
4 # based on ar71xx
5 #
6
7 COMMIT_SYSTEM=0
8
9 set_led_netdev() {
10 local cfg="led_$1"
11 local name=$2
12 local sysfs=$3
13 local dev=$4
14
15 uci -q get system.$cfg && return 0
16
17 uci batch <<EOF
18 set system.$cfg='led'
19 set system.$cfg.name='$name'
20 set system.$cfg.sysfs='$sysfs'
21 set system.$cfg.trigger='netdev'
22 set system.$cfg.dev='$dev'
23 set system.$cfg.mode='link tx rx'
24 EOF
25 COMMIT_SYSTEM=1
26 }
27
28 set_led_usbdev() {
29 local cfg="led_$1"
30 local name=$2
31 local sysfs=$3
32 local dev=$4
33
34 uci -q get system.$cfg && return 0
35
36 uci batch <<EOF
37 set system.$cfg='led'
38 set system.$cfg.name='$name'
39 set system.$cfg.sysfs='$sysfs'
40 set system.$cfg.trigger='usbdev'
41 set system.$cfg.dev='$dev'
42 set system.$cfg.interval='50'
43 EOF
44 COMMIT_SYSTEM=1
45 }
46
47 set_led_wlan() {
48 local cfg="led_$1"
49 local name=$2
50 local sysfs=$3
51 local trigger=$4
52
53 uci -q get system.$cfg && return 0
54
55 uci batch <<EOF
56 set system.$cfg='led'
57 set system.$cfg.name='$name'
58 set system.$cfg.sysfs='$sysfs'
59 set system.$cfg.trigger='$trigger'
60 EOF
61 COMMIT_SYSTEM=1
62 }
63
64 set_led_default() {
65 local cfg="led_$1"
66 local name=$2
67 local sysfs=$3
68 local default=$4
69
70 uci -q get system.$cfg && return 0
71
72 uci batch <<EOF
73 set system.$cfg='led'
74 set system.$cfg.name='$name'
75 set system.$cfg.sysfs='$sysfs'
76 set system.$cfg.default='$default'
77 EOF
78 COMMIT_SYSTEM=1
79 }
80
81 . /lib/lantiq.sh
82
83 board=$(lantiq_board_name)
84
85 case "$board" in
86 ARV7525PW)
87 set_led_netdev "wifi" "wifi" "soc:green:wifi" "wlan0"
88 set_led_default "fxs1" "fxs1" "soc:green:fxs1" "1"
89 set_led_default "fxs2" "fxs2" "soc:green:fxs2" "1"
90 set_led_default "dsl" "dsl" "soc:red:dsl" "1"
91 set_led_default "online" "online" "soc:green:online" "1"
92 ;;
93
94 GIGASX76X)
95 set_led_wlan "wifi" "wifi" "soc:green:wifi" "phy0radio"
96 set_led_netdev "online" "online" "soc:green:online" "nas0"
97 set_led_usbdev "usb" "USB" "soc:green:usb" "1-1"
98 set_led_default "phone1" "fxs1" "soc:green:phone1" "0"
99 set_led_default "phone2" "fxs2" "soc:green:phone2" "0"
100 set_led_default "line" "line" "soc:green:line" "0"
101 ;;
102 esac
103
104 [ "$COMMIT_SYSTEM" == "1" ] && uci commit system
105
106 exit 0
This page took 0.049389 seconds and 5 git commands to generate.