Acpid linux что это

Обновлено: 02.07.2024

служба управления электропитанием через интерфейс ACPI

Поддержка ACPI (Advanced Configuration and Power Interface — улучшенный интерфейс конфигурации и управления электропитанием) имеется в большинстве современных компьютеров и позволяет программно управлять питанием в системе и запрашивать состояние и параметры батарей.

ACPID — это гибкая, расширяемая системная служба для доставки событий ACPI. Она следит за интерфейсом netlink (или за файлом /proc/acpi/event), и когда возникает событие, запускает программу для обработки последнего. Набор запускаемых программ определяется конфигурационными файлами, которые могут устанавливаться пакетами или администратором.

Другие пакеты, относящиеся к acpid

  • rec: acpi-support-base (>= 0.114-1) сценарии обработки основных событий ACPI, например от кнопки питания

Загрузка acpid

Загрузить для всех доступных архитектур
Архитектура Размер пакета В установленном виде Файлы
alpha (неофициальный перенос) 58,4 Кб178,0 Кб [список файлов]
amd64 58,1 Кб169,0 Кб [список файлов]
arm64 57,2 Кб169,0 Кб [список файлов]
armel 55,2 Кб155,0 Кб [список файлов]
armhf 55,4 Кб147,0 Кб [список файлов]
hppa (неофициальный перенос) 56,7 Кб157,0 Кб [список файлов]
i386 59,8 Кб171,0 Кб [список файлов]
ia64 (неофициальный перенос) 63,8 Кб206,0 Кб [список файлов]
m68k (неофициальный перенос) 56,3 Кб167,0 Кб [список файлов]
mips64el 57,9 Кб174,0 Кб [список файлов]
mipsel 57,5 Кб167,0 Кб [список файлов]
ppc64 (неофициальный перенос) 60,0 Кб298,0 Кб [список файлов]
ppc64el 60,2 Кб233,0 Кб [список файлов]
riscv64 (неофициальный перенос) 56,6 Кб158,0 Кб [список файлов]
s390x 56,6 Кб169,0 Кб [список файлов]
sh4 (неофициальный перенос) 59,2 Кб156,0 Кб [список файлов]
sparc64 (неофициальный перенос) 55,2 Кб174,0 Кб [список файлов]
x32 (неофициальный перенос) 57,5 Кб163,0 Кб [список файлов]

Эта страница также доступна на следующих языках (Как установить язык по умолчанию):

Авторские права © 1997 - 2021 SPI Inc.; См. условия лицензии. Debian это торговый знак компании SPI Inc. Об этом сайте.

acpid2 is a flexible and extensible daemon for delivering ACPI events. When an event occurs, it executes programs to handle the event. These events are triggered by certain actions, such as:

  • Pressing special keys, including the Power/Sleep/Suspend button
  • Closing a notebook lid
  • (Un)Plugging an AC power adapter from a notebook
  • (Un)Plugging phone jack etc.
Note: Desktop environments, such as GNOME, systemd login manager and some extra key handling daemons may implement own event handling schemes, independent of acpid. Running more than one system at the same time may lead to unexpected behaviour, such as suspending two times in a row after one sleep button press. You should be aware of this and only activate desirable handlers.

Contents

Installation

Install the acpid package. Then start/enable acpid.service .

Configuration

acpid comes with a number of predefined actions for triggered events, such as what should happen when you press the Power button on your machine. By default, these actions are defined in /etc/acpi/handler.sh , which is executed after any ACPI events are detected (as determined by /etc/acpi/events/anything ).

The following is a brief example of one such action. In this case, when the Sleep button is pressed, acpid runs the command echo -n mem >/sys/power/state which should place the computer into a sleep (suspend) state:

Unfortunately, not every computer labels ACPI events in the same way. For example, the Sleep button may be identified on one machine as SLPB and on another as SBTN.

To determine how your buttons or Fn shortcuts are recognized, run the following command:

Now press the Power button and/or Sleep button (e.g. Fn+Esc ) on your machine. The result should look something this:

If that does not work, run:

Then press the power button and you will see something like this:

The output of acpi_listen is sent to /etc/acpi/handler.sh as $1, $2 , $3 & $4 parameters. Example:

As you might have noticed, the Sleep button in the sample output is actually recognized as SBTN, rather than the SLPB label specified in the default /etc/acpi/handler.sh . In order for Sleep function to work properly on this machine, we would need to replace SLPB) with SBTN).

Alternative configuration

By default, all ACPI events are passed through the /etc/acpi/handler.sh script. This is due to the ruleset outlined in /etc/acpi/events/anything :

While this works just fine as it is, some users may prefer to define event rules and actions in their own self-contained scripts. The following is an example of how to use an individual event file and corresponding action script:

As root, create the following file:

Now create the following file:

Make the script executable:

Finally, reload the acpid.service to get acpid to recognize the changes to these files.

Using this method, it is easy to create any number of individual event/action scripts.

Tips and tricks

Note: Some of the actions described here, such as Wi-Fi toggle and backlight control, may already be managed directly by driver. You should consult documentation of corresponding kernel modules, when this is the case.

Example events

The following are examples of events that can be used in the /etc/acpi/handler.sh script. These examples should be modified so that they apply your specific environment e.g. changing the event variable names interpreted by acpi_listen .

To set the laptop screen brightness when plugged in power or not (the numbers might need to be adjusted, see /sys/class/backlight/acpi_video0/max_brightness ):

Enabling volume control

Find out the acpi identity of the volume buttons (see above) and substitute it for the acpi events in the files below.

Note: These commands may not work as expected with PulseAudio. [1] For full functionality, run commands as the current user while specifying the XDG_RUNTIME_DIR environment variable, for example with sudo -u user XDG_RUNTIME_DIR=/run/user/1000 pactl . Tip: Disable or bind the volume buttons in Xorg to prevent conflicts with other applications. See Xmodmap for details.

Enabling backlight control

Similar to volume control, acpid also enables you to control screen backlight. To achieve this you write some handler, like this:

and again, connect keys to ACPI events:

Enabling Wi-Fi toggle

You can also create a simple wireless-power switch by pressing the WLAN button. Example of event:

and its handler:

Getting user name of the current display

To run commands depending on Xorg, defining the X display as well as the MIT magic cookie file (via XAUTHORITY) is required. Latter is a security credential providing read and write access to the X server, display, and any input devices (see xauth(1) ).

The Advanced Configuration and Power Interface (ACPI) specification was developed to establish industry common interfaces enabling robust operating system (OS) directed motherboard device configuration and power management of both devices and entire systems. ACPI is the key element in OS-directed configuration and Power Management (OSPM).

ACPI modules are kernel modules for different ACPI parts. They enable special ACPI functions or add information to /proc or /sys . These information can be parsed by acpid for events or other monitoring applications.

Contents

Which modules are available?

This is a small list and summary of ACPI kernel modules:

  • ac (power connector status)
  • asus-laptop (useful on ASUS/medion laptops)
  • battery (battery status)
  • bay (bay status)
  • button (catch button events, like LID or POWER BUTTON)
  • container (container status)
  • dock (docking station status)
  • fan (fan status)
  • i2c_ec (EC SMBus driver)
  • thinkpad_acpi (useful on Lenovo ThinkPad laptops)
  • processor (processor status)
  • sbs (smart battery status)
  • thermal (status of thermal sensors)
  • toshiba_acpi (useful for Toshiba laptops)
  • video (status of video devices)

A complete list for your running kernel can be obtained with the following command:

How to select the correct ones

You have to try yourself which module works for your machine using modprobe yourmodule , then check if the module is supported on your hardware by using dmesg. It may help to add a grep text search to narrow your results:

Getting information

To read out battery information, you can simply install the package acpi and run acpi -i .

Using /proc to store ACPI information has been discouraged and deprecated since Linux 2.6.24. The same data is available in /sys now, and interested parties can (should) subscribe to ACPI events from the kernel via netlink. For example, for battery:

Troubleshooting

DSDT fix

If problems with power management persist despite having loaded the proper modules, a Linux-unfriendly DSDT might be the cause. See the wiki article on DSDT.

ACPI fix for notebooks

Sometimes you see "ACPI: EC: input buffer is not empty, aborting transaction". This is a problem with ACPI, more specifically an incompatibility of the BIOS. There may be four ways to solve this issue:

служба управления электропитанием через интерфейс ACPI

Поддержка ACPI (Advanced Configuration and Power Interface — улучшенный интерфейс конфигурации и управления электропитанием) имеется в большинстве современных компьютеров и позволяет программно управлять питанием в системе и запрашивать состояние и параметры батарей.

ACPID — это гибкая, расширяемая системная служба для доставки событий ACPI. Она следит за интерфейсом netlink (или за файлом /proc/acpi/event), и когда возникает событие, запускает программу для обработки последнего. Набор запускаемых программ определяется конфигурационными файлами, которые могут устанавливаться пакетами или администратором.

Другие пакеты, относящиеся к acpid

  • rec: acpi-support-base (>= 0.114-1) сценарии обработки основных событий ACPI, например от кнопки питания

Загрузка acpid

Загрузить для всех доступных архитектур
Архитектура Размер пакета В установленном виде Файлы
alpha (неофициальный перенос) 58,4 Кб178,0 Кб [список файлов]
amd64 58,1 Кб169,0 Кб [список файлов]
arm64 57,2 Кб169,0 Кб [список файлов]
armel 55,2 Кб155,0 Кб [список файлов]
armhf 55,4 Кб147,0 Кб [список файлов]
hppa (неофициальный перенос) 56,7 Кб157,0 Кб [список файлов]
i386 59,8 Кб171,0 Кб [список файлов]
ia64 (неофициальный перенос) 63,8 Кб206,0 Кб [список файлов]
m68k (неофициальный перенос) 56,3 Кб167,0 Кб [список файлов]
mips64el 57,9 Кб174,0 Кб [список файлов]
mipsel 57,5 Кб167,0 Кб [список файлов]
ppc64 (неофициальный перенос) 60,0 Кб298,0 Кб [список файлов]
ppc64el 60,2 Кб233,0 Кб [список файлов]
riscv64 (неофициальный перенос) 56,6 Кб158,0 Кб [список файлов]
s390x 56,6 Кб169,0 Кб [список файлов]
sh4 (неофициальный перенос) 59,2 Кб156,0 Кб [список файлов]
sparc64 (неофициальный перенос) 55,2 Кб174,0 Кб [список файлов]
x32 (неофициальный перенос) 57,5 Кб163,0 Кб [список файлов]

Эта страница также доступна на следующих языках (Как установить язык по умолчанию):

Авторские права © 1997 - 2021 SPI Inc.; См. условия лицензии. Debian это торговый знак компании SPI Inc. Об этом сайте.

Читайте также: