summaryrefslogtreecommitdiff
path: root/target/linux/lantiq/base-files/etc/diag.sh
blob: d0088f5bcc03186863cb653521c5db797f62a80b (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
#!/bin/sh
# Copyright (C) 2012 OpenWrt.org

[ -d /sys/class/leds/power/ ] || return

set_state() {
	[ -d /sys/class/leds/power1/ ] && {

		case "$1" in
		preinit)
			echo heartbeat >/sys/class/leds/power/trigger
			;;
		failsafe)
			echo none >/sys/class/leds/power/trigger
			echo timer >/sys/class/leds/power1/trigger
			echo 100 >/sys/class/leds/power1/delay_on
			echo 100 >/sys/class/leds/power1/delay_off
			;;
		done)
			echo none >/sys/class/leds/power/trigger
			echo none >/sys/class/leds/power1/trigger
			echo 1 >/sys/class/leds/power/brightness
			;;
		esac
		return
	}

	case "$1" in
	preinit)
		echo heartbeat >/sys/class/leds/power/trigger
		;;
	failsafe)
		echo timer >/sys/class/leds/power/trigger
		echo 100 >/sys/class/leds/power/delay_on
		echo 100 >/sys/class/leds/power/delay_off
		;;
	done)
		echo none >/sys/class/leds/power/trigger
		echo 1 >/sys/class/leds/power/brightness
		;;
	esac
}