aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/base-files/etc/diag.sh
blob: 26f0a3c8a91fffda9a23f1dd34ac63f705f3801b (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-2013 OpenWrt.org

. /lib/functions/leds.sh

status_led="power"

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

		case "$1" in
		preinit)
			led_set_attr "power2" "trigger" "heartbeat"
			status_led_on
			;;
		failsafe)
			led_off "power2"
			status_led_set_timer 100 100
			;;
		done)
			led_off "power2"
			;;
		esac
		return
	}

	case "$1" in
	preinit)
		status_led_set_heartbeat
		;;
	failsafe)
		[ -d /sys/class/leds/power1 ] && {
			status_led_off
			led_timer "power1" 100 100
		} || status_led_set_timer 100 100
		;;
	done)
		status_led_on
		led_off "power1"
		;;
	esac
}