-
Notifications
You must be signed in to change notification settings - Fork 2
/
handler.sh
executable file
·145 lines (134 loc) · 3.81 KB
/
handler.sh
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
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/sh
# Default acpi script that takes an entry for all actions
set $*
ev_type=`echo "$1" | cut -d/ -f1`
# We have to take special care for events send by ibm/hotkey:
if [ "$ev_type" = "ibm" ]; then
ev_type=`echo "$1" | cut -d/ -f1`
event=`echo "$1" | cut -d/ -f2`
key="$2"\ "$3"\ "$4"
else
# Take care about the way events are reported
ev_type=`echo "$1" | cut -d/ -f1`
if [ "$ev_type" = "$1" ]; then
event="$2";
else
event=`echo "$1" | cut -d/ -f2`
fi
fi
case "$ev_type" in
button)
case "$event" in
power)
logger "acpid: power button pressed; starting shutdown"
/sbin/init 0
break
;;
sleep)
logger "acpid: sleep button pressed; initiating hibernate-ram"
/usr/sbin/pm-suspend
;;
lid)
logger "acpid: lid event"
;;
*)
logger "acpid: action $2 is not defined"
;;
esac
;;
# BEGIN customization for ibm/hotkey:
ibm)
case "$event" in
hotkey)
case "$key" in
"HKEY 00000080 00001002")
logger "acpid: lock button (Fn+F2) pressed"
/etc/acpi/actions/lock
;;
"HKEY 00000080 00001003")
logger "acpid: battery button (Fn+F3) pressed; switching display off"
/etc/acpi/actions/battery
;;
"HKEY 00000080 00001004")
logger "acpid: sleep button (Fn+F4) pressed; initiating hibernate-ram"
/etc/acpi/actions/suspend
;;
"HKEY 00000080 00001005")
logger "acpid: bluetooth button (Fn+F5) pressed; toggling bluetooth"
/etc/acpi/actions/radio
;;
"HKEY 00000080 00001007")
logger "acpid: screen toggle button (Fn+F7) pressed"
/etc/acpi/actions/screen
;;
"HKEY 00000080 00001008")
logger "acpid: UltraNav toggle button (Fn+F8) pressed; toggling touchpad status"
/etc/acpi/actions/touchpad
;;
"HKEY 00000080 00001009")
logger "acpid: eject button (Fn+F9) pressed"
/etc/acpi/actions/eject
;;
"HKEY 00000080 0000100c")
logger "acpid: hibernate button (Fn+F12) pressed; initiating hibernate"
/etc/acpi/actions/hibernate
;;
"HKEY 00000080 00007000")
logger "acpid: radio switch action; toggling all wireless devices"
/etc/acpi/actions/killswitch
;;
"HKEY 00000080 00001010")
logger "acpid: increase brightness"
/etc/acpi/actions/brightness up
break
;;
"HKEY 00000080 00001011")
logger "apcid: decrease brightness"
/etc/acpi/actions/brightness down
break
;;
"HKEY 00000080 00005001")
# This is the lid CLOSE event
# as of now it is already handled above
;;
"HKEY 00000080 00005002")
# This is the lid OPEN event
# as of now it is already handled above
;;
*)
logger "acpid: $ev_type/$event $key is not defined"
;;
esac
;;
dock)
case "$key" in
"GDCK 00000003 00000001")
logger "acpid: Dock eject request"
;;
"GDCK 00000003 00000002")
logger "acpid: laptop was undocked"
;;
"GDCK 00000000 00000003")
logger "acpid: laptop was docked"
;;
*)
logger "acpid: $ev_typ $event event $key is not defined"
;;
esac
;;
bay)
case "$key" in
"MSTR 00000003 00000000")
logger "acpid: got ultrabay eject request"
;;
"MSTR 00000001 00000000")
logger "acpid: ultrabay eject lever inserted"
;;
esac
;;
esac
;;
*)
logger "ACPI group $1 / action $2 is not defined"
;;
esac