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

. /lib/functions/leds.sh

status_led=power
[ ! -d /sys/class/leds/power/ ] && [ ! -d /sys/class/leds/power1/ ] && [ ! -d /sys/class/leds/power2/ ] && [ -d /sys/class/leds/wps/ ] && status_led=wps

set_state() {
	case "$1" in
	preinit)
		if [ -d /sys/class/leds/power2/ ]; then
			status_led_on
			status_led=power2
			status_led_blink_preinit
			status_led=power
		else
			status_led_blink_preinit
		fi
		;;
	failsafe)
		if [ -d /sys/class/leds/power2/ ]; then
			led_off power2
			status_led_blink_failsafe
		elif [ -d /sys/class/leds/power1/ ]; then
			status_led_off
			status_led=power1
			status_led_blink_failsafe
			status_led=power
		else
			status_led_blink_failsafe
		fi
		;;
	preinit_regular)
		if [ -d /sys/class/leds/power2/ ]; then
			status_led_on
			status_led=power2
			status_led_blink_preinit_regular
			status_led=power
		else
			status_led_blink_preinit_regular
		fi
		;;
	done)
		status_led_on
		led_off power1
		led_off power2
		;;
	esac
}