Blame acpid.8

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