summaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/base-files/etc/uci-defaults/leds
blob: 2a7db4c1a817f0e294b192553231064632ea04fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/sh
#
# Copyright (C) 2011 OpenWrt.org
# based on ar71xx
#

COMMIT_SYSTEM=0

set_led_netdev() {
	local cfg="led_$1"
	local name=$2
	local sysfs=$3
	local dev=$4

	uci -q get system.$cfg && return 0

	uci batch <<EOF
set system.$cfg='led'
set system.$cfg.name='$name'
set system.$cfg.sysfs='$sysfs'
set system.$cfg.trigger='netdev'
set system.$cfg.dev='$dev'
set system.$cfg.mode='link tx rx'
EOF
	COMMIT_SYSTEM=1
}

set_led_usbdev() {
	local cfg="led_$1"
	local name=$2
	local sysfs=$3
	local dev=$4

	uci -q get system.$cfg && return 0

	uci batch <<EOF
set system.$cfg='led'
set system.$cfg.name='$name'
set system.$cfg.sysfs='$sysfs'
set system.$cfg.trigger='usbdev'
set system.$cfg.dev='$dev'
set system.$cfg.interval='50'
EOF
	COMMIT_SYSTEM=1
}

set_led_wlan() {
	local cfg="led_$1"
	local name=$2
	local sysfs=$3
	local trigger=$4

	uci -q get system.$cfg && return 0

	uci batch <<EOF
set system.$cfg='led'
set system.$cfg.name='$name'
set system.$cfg.sysfs='$sysfs'
set system.$cfg.trigger='$trigger'
EOF
	COMMIT_SYSTEM=1
}

set_led_default() {
	local cfg="led_$1"
	local name=$2
	local sysfs=$3
	local default=$4

	uci -q get system.$cfg && return 0

	uci batch <<EOF
set system.$cfg='led'
set system.$cfg.name='$name'
set system.$cfg.sysfs='$sysfs'
set system.$cfg.default='$default'
EOF
	COMMIT_SYSTEM=1
}

. /lib/lantiq.sh

board=$(lantiq_board_name)

case "$board" in
ARV4520PW|ARV452CPW)
	set_led_netdev "wifi" "wifi" "soc:blue:wifi" "wlan0"
	set_led_usbdev "usb" "USB" "soc:blue:usb" "1-1"
	set_led_default "fxs1" "fxs1" "soc:blue:fxs1" "1"
	set_led_default "fxs2" "fxs2" "soc:blue:fxs2" "1"
	set_led_default "online" "online" "soc:blue:internet" "1"
	;;

ARV7525PW)
	set_led_netdev "wifi" "wifi" "soc:green:wifi" "wlan0"
	set_led_default "fxs1" "fxs1" "soc:green:fxs1" "1"
	set_led_default "fxs2" "fxs2" "soc:green:fxs2" "1"
	set_led_default "dsl" "dsl" "soc:red:dsl" "1"
	set_led_default "online" "online" "soc:green:online" "1"
	;;

ARV4525PW)
	set_led_netdev "wifi" "wifi" "soc:green:wifi" "wlan0"
	set_led_default "fxs1" "fxs1" "soc:green:fxs1" "1"
	set_led_default "fxs2" "fxs2" "soc:green:fxs2" "1"
	set_led_default "dsl" "dsl" "soc:green:dsl" "1"
	set_led_default "online" "online" "soc:green:online" "1"
	;;

GIGASX76X)
	set_led_wlan "wifi" "wifi" "soc:green:wifi" "phy0radio"
	set_led_netdev "online" "online" "soc:green:online" "pppoe-wan"
	set_led_usbdev "usb" "USB" "soc:green:usb" "1-1"
	;;

ARV4519PW)
	set_led_wlan "wifi" "wifi" "soc:green:wifi" "phy0radio"
	set_led_netdev "internet" "internet" "soc:green:internet" "pppoe-wan"
	set_led_usbdev "usb" "USB" "soc:green:usb" "1-1"
	;;

ARV7518PW)
	set_led_wlan "wifi" "wifi" "soc:green:wifi" "phy0radio"
	set_led_netdev "internet" "internet" "soc:green:internet" "pppoe-wan"
	set_led_usbdev "usb" "USB" "soc:green:usb" "1-1"
	;;
esac

[ "$COMMIT_SYSTEM" == "1" ] && uci commit system

exit 0