aboutsummaryrefslogtreecommitdiff
path: root/system/etc/acpi/handler.sh
blob: 1cc28ff49c16a19edf4d7a959801c6673429933f (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
#!/bin/bash
# Default acpi script that takes an entry for all actions

case "$1" in
	button/power)
		case "$2" in
			PBTN|PWRF)
				logger 'PowerButton pressed'
				;;
			*)
				logger "ACPI action undefined: $2"
				;;
		esac
		;;
	button/sleep)
		case "$2" in
			SLPB|SBTN)
				pm-suspend
				logger 'SuspendButton pressed'
				;;
			*)
				logger "ACPI action undefined: $2"
				;;
		esac
		;;
	ac_adapter)
		case "$2" in
			AC|ACAD|ADP0)
				case "$4" in
					00000000)
						logger 'AC unpluged'
			echo 1000 > /sys/class/backlight/intel_backlight/brightness
						;;
					00000001)
						logger 'AC pluged'
			echo 5273 > /sys/class/backlight/intel_backlight/brightness
						;;
				esac
				;;
			*)
				logger "ACPI action undefined: $2"
				;;
		esac
		;;
	battery)
		case "$2" in
			BAT0)
				case "$4" in
					00000000)
						logger 'Battery online'
						;;
					00000001)
						logger 'Battery offline'
						;;
				esac
				;;
			CPU0)
				;;
			*)  logger "ACPI action undefined: $2" ;;
		esac
		;;
	button/lid)
		case "$3" in
			close)
				logger 'LID closed'
				pm-suspend
				;;
			open)
				logger 'LID opened'
				;;
			*)
				logger "ACPI action undefined: $3"
				;;
		esac
		;;
	*)
		logger "ACPI group/action undefined: $1 / $2"
		;;
esac