ACPID
acpid is a daemon that
monitors ACPI events and (on Slackware) indirectly runs the shell
script /etc/acpi/acpi_handler.sh
for each event. This script can be modified to perform actions when
events occur. The distributed script contains only one action:
'/sbin/init 0' is run when the power button is pressed.
There is an ACPI HowTo
that provides (in section 6.4) some explanation of the events. I
also modified the acpi_handler script to log all events, and tried
doing various things (pressing buttons, etc.) to see what events are
generated. Grepping the kernel source provided further information.
There are 4 arguments passed to the acpi_handler script, which
specify the event that has occurred: the device class name, the
bus ID name, the event type, and the event data. The following table
lists what I have discovered about events on nettle.
Device class name
|
Bus ID name
|
Event type
|
Event data
|
Event description |
ac_adapter |
ADP1 |
00000080 |
00000000 |
AC adapter unplugged |
ac_adapter |
ADP1 |
00000080 |
00000001 |
AC adapter plugged in again |
battery |
BAT0 |
00000080 |
00000000 |
|
battery |
BAT0 |
00000080 |
00000001 |
|
button/lid |
LID0 |
00000080 |
00000010 |
Lid opened or closed. The event data appears to be simply
incremented
each time the event occurs. |
button/power |
PWRF |
00000080 |
00000001 |
Power button pressed. |
button/sleep
|
SLPB
|
00000080 |
00000010 |
Sleep button (Fn-F2) pressed.
The event data appears to be simply incremented
each time the event occurs. |
embedded_controller
|
EC0
|
|
|
|
processor
|
CPU0
|
00000080 |
00000000 |
|
processor
|
CPU0
|
00000081 |
00000000 |
|
thermal_zone
|
THRC
|
|
|
|
thermal_zone
|
THRS
|
|
|
|
video/VGA
|
CRT
|
|
|
|
video/VGA |
LCD
|
|
|
|
video/VGA |
TVO
|
|
|
|
The device class name and bus ID name together correspond to a
directory under /proc/acpi.
For example, there is a directory /proc/acpi/ac_adapter/ADP1,
which contains information about the AC adapter, and there is a
directory /proc/acpi/button/power,
which contains information about the power button.
Each of these directories contains one or more text files. There
doesn't appear to be any standard for the names or contents of these
files. Here are a couple of examples:
/proc/acpi/ac_adapter/ADP1/state:
state:
on-line
/proc/acpi/battery/BAT0/info:
present:
yes
design capacity: 4400
mAh
last full capacity: 4400 mAh
battery technology: rechargeable
design voltage:
14800 mV
design capacity warning: 440 mAh
design capacity low: 176 mAh
capacity granularity 1: 264 mAh
capacity granularity 2: 3960 mAh
model
number:
BAT0
serial
number: 236
battery
type:
Lion
OEM
info:
SMP