Blame acpid.8

Packit a94d48
.TH acpid 8 ""
Packit a94d48
.\" Portions Copyright (c) 2001 Sun Microsystems
Packit a94d48
.\" Portions Copyright (c) Tim Hockin (thockin@hockin.org)
Packit a94d48
.SH NAME
Packit a94d48
acpid \- Advanced Configuration and Power Interface event daemon
Packit a94d48
.SH SYNOPSIS
Packit a94d48
\fBacpid\fP [\fIoptions\fP]
Packit a94d48
Packit a94d48
.SH DESCRIPTION
Packit a94d48
\fBacpid\fP is designed to notify user-space programs of ACPI events.
Packit a94d48
\fBacpid\fP should be started during the system boot, and will run as a
Packit a94d48
background process, by default.  It will open an events file
Packit a94d48
(\fI/proc/acpi/event\fP by default) and attempt to read whole lines which
Packit a94d48
represent ACPI events.  If the events file does not exist, \fBacpid\fP will
Packit a94d48
attempt to connect to the Linux kernel via the input layer and netlink.  When an
Packit a94d48
ACPI event is received from one of these sources, \fBacpid\fP will examine a
Packit a94d48
list of rules, and execute the rules that match the event. \fBacpid\fP will
Packit a94d48
ignore all incoming ACPI events if a lock file exists (\fI/var/lock/acpid\fP by
Packit a94d48
default).
Packit a94d48
.PP
Packit a94d48
\fIRules\fP are defined by simple configuration files.  \fBacpid\fP
Packit a94d48
will look in a configuration directory (\fI/etc/acpi/events\fP by default),
Packit a94d48
and parse all regular files with names that consist entirely of upper and
Packit a94d48
lower case letters, digits, underscores, and hyphens (similar to
Packit a94d48
.BR run-parts (8))
Packit a94d48
that do not begin with a period ('.') or end with a tilde (~).
Packit a94d48
Each file must define two things: an \fIevent\fP and an
Packit a94d48
\fIaction\fP.  Any blank lines, or lines where the first character is a
Packit a94d48
hash ('#') are ignored.  Extraneous lines are flagged as warnings, but
Packit a94d48
are not fatal.  Each line has three tokens: the key, a literal equal sign,
Packit a94d48
and the value.  The key can be up to 63 characters, and is case-insensitive
Packit a94d48
(but whitespace matters).  The value can be up to 511 characters, and is
Packit a94d48
case and whitespace sensitive.
Packit a94d48
.PP
Packit a94d48
The event value is a regular expression (see
Packit a94d48
.BR regcomp (3)),
Packit a94d48
against which events are matched.
Packit a94d48
.PP
Packit a94d48
The action value is a commandline, which will be invoked via \fI/bin/sh\fP
Packit a94d48
whenever an event matching the rule in question occurs.  The commandline may
Packit a94d48
include shell-special characters, and they will be preserved.  The only special
Packit a94d48
characters in an action value are "%" escaped.  The string "%e" will be
Packit a94d48
replaced by the literal text of the event for which the action was invoked.
Packit a94d48
This string may contain spaces, so the commandline must take care to quote the "%e" if it wants a single token.  The string "%%" will be replaced by a
Packit a94d48
literal "%".  All other "%" escapes are reserved, and will cause a rule to
Packit a94d48
not load.
Packit a94d48
.PP
Packit a94d48
This feature allows multiple rules to be defined for the same event (though no
Packit a94d48
ordering is guaranteed), as well as one rule to be defined for multiple events.
Packit a94d48
To force \fBacpid\fP to reload the rule configuration, send it a SIGHUP.
Packit a94d48
.PP
Packit a94d48
The pseudo-action \fI<drop>\fP causes the event to be dropped
Packit a94d48
completely and no further processing undertaken; clients connecting
Packit a94d48
via the UNIX domain socket (see below) will not be notified of the
Packit a94d48
event. This may be useful on some machines, such as certain laptops which
Packit a94d48
generate spurious battery events at frequent intervals. The name of
Packit a94d48
this pseudo-action may be redefined with a commandline option.
Packit a94d48
.PP
Packit a94d48
In addition to rule files, \fBacpid\fP also accepts connections on a UNIX
Packit a94d48
domain socket (\fI/var/run/acpid.socket\fP by default).  Any application may
Packit a94d48
connect to this socket.  Once connected, \fBacpid\fP will send the text of
Packit a94d48
all ACPI events to the client.  The client has the responsibility of filtering
Packit a94d48
for messages about which it cares.  \fBacpid\fP will not close the client
Packit a94d48
socket except in the case of a SIGHUP or \fBacpid\fP exiting.
Packit a94d48
.PP
Packit a94d48
For faster startup, this socket can be passed in as stdin so that \fBacpid\fP
Packit a94d48
need not create the socket.  In addition, if a socket is passed in as stdin, 
Packit a94d48
\fBacpid\fP will not daemonize.  It will be run in foreground.  This behavior 
Packit a94d48
is provided to support
Packit a94d48
.BR systemd (1).
Packit a94d48
.PP
Packit a94d48
.B acpid
Packit a94d48
will log all of its activities, as well as the stdout and stderr of any
Packit a94d48
actions, to syslog.
Packit a94d48
.PP
Packit a94d48
All the default files and directories can be changed with commandline options.
Packit a94d48
.SH OPTIONS
Packit a94d48
.TP 12
Packit a94d48
.BI \-c "\fR, \fP" \-\-confdir " directory"
Packit a94d48
This option changes the directory in which \fBacpid\fP looks for rule
Packit a94d48
configuration files.  Default is \fI/etc/acpi/events\fP.
Packit a94d48
.TP 12
Packit a94d48
.BI \-C "\fR, \fP" \-\-clientmax " number"
Packit a94d48
This option changes the maximum number of non-root socket connections which
Packit a94d48
can be made to the \fBacpid\fP socket.  Default is \fI256\fP.
Packit a94d48
.TP 12
Packit a94d48
.BI \-d "\fR, \fP" \-\-debug
Packit a94d48
This option increases the \fBacpid\fP debug level by one.
Packit a94d48
.TP
Packit a94d48
.BI \-e "\fR, \fP" \-\-eventfile " filename"
Packit a94d48
This option changes the event file from which \fBacpid\fP reads events.
Packit a94d48
Default is \fI/proc/acpi/event\fP.
Packit a94d48
.TP
Packit a94d48
.BI \-n "\fR, \fP" \-\-netlink
Packit a94d48
This option forces \fBacpid\fP to use the Linux kernel input layer and netlink interface for ACPI events.
Packit a94d48
.TP
Packit a94d48
.BI \-f "\fR, \fP" \-\-foreground
Packit a94d48
This option keeps \fBacpid\fP in the foreground by not forking at startup,
Packit a94d48
and makes it log to stderr instead of syslog.
Packit a94d48
.TP
Packit a94d48
.BI \-l "\fR, \fP" \-\-logevents
Packit a94d48
This option tells \fBacpid\fP to log information about all events and actions.
Packit a94d48
.TP
Packit a94d48
.BI \-L "\fR, \fP" \-\-lockfile " filename"
Packit a94d48
This option changes the lock file used to stop event processing.
Packit a94d48
Default is \fI/var/lock/acpid\fP.
Packit a94d48
.TP
Packit a94d48
.BI \-g "\fR, \fP" \-\-socketgroup " groupname"
Packit a94d48
This option changes the group ownership of the UNIX domain socket to which
Packit a94d48
\fBacpid\fP publishes events.
Packit a94d48
.TP
Packit a94d48
.BI \-m "\fR, \fP" \-\-socketmode " mode"
Packit a94d48
This option changes the permissions of the UNIX domain socket to which
Packit a94d48
\fBacpid\fP publishes events.  Default is \fI0666\fP.
Packit a94d48
.TP
Packit a94d48
.BI \-s "\fR, \fP" \-\-socketfile " filename"
Packit a94d48
This option changes the name of the UNIX domain socket which \fBacpid\fP opens.
Packit a94d48
Default is \fI/var/run/acpid.socket\fP.
Packit a94d48
.TP
Packit a94d48
.BI \-S "\fR, \fP" \-\-nosocket " filename"
Packit a94d48
This option tells \fBacpid\fP not to open a UNIX domain socket.  This
Packit a94d48
overrides the \fI-s\fP option, and negates all other socket options.
Packit a94d48
.TP
Packit a94d48
.BI \-p "\fR, \fP" \-\-pidfile " filename"
Packit a94d48
This option tells \fBacpid\fP to use the specified file as its pidfile.  If
Packit a94d48
the file exists, it will be removed and over-written.
Packit a94d48
Default is \fI/var/run/acpid.pid\fP.
Packit a94d48
.TP
Packit a94d48
.BI \-r "\fR, \fP" \-\-dropaction " action"
Packit a94d48
This option defines the pseudo-action which tells \fBacpid\fP to abort
Packit a94d48
all processing of an event, including client notifications.
Packit a94d48
Default is \fI<drop>\fP.
Packit a94d48
.TP
Packit a94d48
.BI \-t "\fR, \fP" \-\-tpmutefix
Packit a94d48
This option enables special handling of the mute button for certain
Packit a94d48
ThinkPad models with mute LEDs that get out of sync with the mute state
Packit a94d48
when the mute button is held down.  With this option, the mute button
Packit a94d48
will generate the following events in sync with the number of presses
Packit a94d48
(and, by extension, the state of the LED):
Packit a94d48
.IP
Packit a94d48
.br
Packit a94d48
button/mute MUTE (key pressed) K
Packit a94d48
.br
Packit a94d48
button/mute MUTE (key released) K
Packit a94d48
.TP
Packit a94d48
.BI \-v "\fR, \fP" \-\-version
Packit a94d48
Print version information and exit.
Packit a94d48
.TP
Packit a94d48
.BI \-h "\fR, \fP" \-\-help
Packit a94d48
Show help and exit.
Packit a94d48
.SH EXAMPLE
Packit a94d48
This example will shut down your system if you press the power button.
Packit a94d48
.PP
Packit a94d48
Create a file named /etc/acpi/events/power that contains the following:
Packit a94d48
.IP
Packit a94d48
.br
Packit a94d48
event=button/power
Packit a94d48
.br
Packit a94d48
action=/etc/acpi/power.sh "%e"
Packit a94d48
.PP
Packit a94d48
Then create a file named /etc/acpi/power.sh that contains the following:
Packit a94d48
.IP
Packit a94d48
/sbin/shutdown \-h now "Power button pressed"
Packit a94d48
.PP
Packit a94d48
Now, when \fBacpid\fP is running, a press of the power button will cause the
Packit a94d48
rule in /etc/acpi/events/power to trigger the script in /etc/acpi/power.sh.
Packit a94d48
The script will then shut down the system.
Packit a94d48
.SH TROUBLESHOOTING
Packit a94d48
\fBacpid\fP is a simple program that runs scripts in response to ACPI
Packit a94d48
events from the kernel.  When there's trouble, the problem is rarely
Packit a94d48
with \fBacpid\fP itself.  The following are some suggestions for
Packit a94d48
finding the most common sources of ACPI-related problems.
Packit a94d48
.PP
Packit a94d48
When troubleshooting \fBacpid\fP, it is important to be aware that other parts
Packit a94d48
of a system might be handling ACPI events.
Packit a94d48
.BR systemd (1)
Packit a94d48
is capable of handling the power switch and various other
Packit a94d48
events that are commonly handled by \fBacpid\fP.  See the description of
Packit a94d48
HandlePowerKey in
Packit a94d48
.BR logind.conf (5)
Packit a94d48
for more.  Some window managers also
Packit a94d48
take over \fBacpid\fP's normal handling of the power button and other events.
Packit a94d48
.PP
Packit a94d48
.BR kacpimon (8)
Packit a94d48
can be used to verify that the expected ACPI events are
Packit a94d48
coming in.  See the man page for
Packit a94d48
.BR kacpimon (8)
Packit a94d48
for the proper procedure.
Packit a94d48
If the events aren't
Packit a94d48
coming in, you've probably got a kernel driver issue.
Packit a94d48
.PP
Packit a94d48
If the expected events are coming in, then you'll need
Packit a94d48
to check and see if your window manager is responsible for
Packit a94d48
handling these events.  Some are, some aren't.  (E.g. in Ubuntu
Packit a94d48
14.04 (Unity/GNOME), there are settings for the laptop lid in the
Packit a94d48
System Settings > Power > "When the lid is closed" fields.)
Packit a94d48
If your window manager is responsible for handling the problematic
Packit a94d48
event, and you've got it configured properly, then you may have a
Packit a94d48
window manager issue.
Packit a94d48
.PP
Packit a94d48
Lastly, take a look in \fI/etc/acpi/events\fP (see above).  Is there
Packit a94d48
a configuration file in there for the event
Packit a94d48
in question (e.g. /etc/acpi/events/lidbtn for laptop lid open/close
Packit a94d48
events)?  Is it properly connected to a
Packit a94d48
script (e.g. /etc/acpi/lid.sh)?  Is that script working?  It's not
Packit a94d48
unusual for an \fBacpid\fP script to check and see if there is a window
Packit a94d48
manager running, then do nothing if there is.  This means it is up
Packit a94d48
to the window manager to handle this event.
Packit a94d48
.SH DEPENDENCIES
Packit a94d48
\fBacpid\fP should work on any linux kernel released since 2003.
Packit a94d48
.SH FILES
Packit a94d48
.PD 0
Packit a94d48
.B /proc/acpi/event
Packit a94d48
.br
Packit a94d48
.B /dev/input/event*
Packit a94d48
.br
Packit a94d48
.B /etc/acpi/
Packit a94d48
.br
Packit a94d48
.B /var/run/acpid.socket
Packit a94d48
.br
Packit a94d48
.B /var/run/acpid.pid
Packit a94d48
.br
Packit a94d48
.B /var/lock/acpid
Packit a94d48
.br
Packit a94d48
.PD
Packit a94d48
.SH BUGS
Packit a94d48
There are no known bugs.  To file bug reports, see \fBPROJECT WEBSITE\fP 
Packit a94d48
below.
Packit a94d48
.SH SEE ALSO
Packit a94d48
.BR regcomp (3)
Packit a94d48
.BR sh (1)
Packit a94d48
.BR socket (2)
Packit a94d48
.BR connect (2)
Packit a94d48
.BR init (1)
Packit a94d48
.BR systemd (1)
Packit a94d48
.BR acpi_listen (8)
Packit a94d48
.BR kacpimon (8)
Packit a94d48
.SH PROJECT WEBSITE
Packit a94d48
http://sourceforge.net/projects/acpid2/
Packit a94d48
.SH AUTHORS
Packit a94d48
Ted Felix <ted@tedfelix.com>
Packit a94d48
.br
Packit a94d48
Tim Hockin <thockin@hockin.org>
Packit a94d48
.br
Packit a94d48
Andrew Henroid
Packit a94d48