What is acpi linux

ACPI modules

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:

Add the working ones to configuration files in /etc/modules-load.d . /etc/modules-load.d is described in Kernel modules#Automatic module loading with systemd.

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

Трудно приходится линуксоидам, не имеющим DE, а сидящим исключительно на WM — всё, что в полноценном Desktop Environment ( окружении рабочего стола или как это лучше обозначить на великом и могучем? ) поставляется и работает «из коробки» в WM нужно подбирать и настраивать. Вот и автором сего поста ранее были использованы элементы xfce для таких вещей как управление питанием, регулировка громкости звука и яркости экрана. Но вступило что-то в голову: ведь в моей системе всегда установлены acpi и laptop-mode-tools, так почему бы не обучить их выполнять их же непосредственные обязанности: делать всё то, для чего раньше нужны были xfce4-volumed и xfce4-power-manager?

Читайте также:  Все папки видимы mac os

Для обучения нам понадобятся пакеты laptop-mode-tools , acpi , acpid . Acpid должен быть запущен.

Уровень яркости экрана

Дописать в /etc/default/grub строки:

Лезем в acpi. Создайте файлы со следующим содержанием.

Для увеличения яркости:

Для уменьшения яркости:

В bl_device замените inel_backlight на своё значение в зависимости от используемой видеокарты. Также стоит выяснить устраивающее вас значение, на основе которого будет увеличиваться или уменьшаться яркость экрана. У автора это значение = 200.

Как найти подходящее значение? Посмотрите какая цифра стоит сейчас. Если вы ничего ещё не настраивали, она должна отражать максимально допустимое значение:

Теперь поиграйте со значениями, чтобы выбрать нужный шаг:

Посмотрите как будет изменяться яркость экрана при разных значениях, если при добавлении 10 единиц вы практически не чувствуете разницы, добавьте ещё 50-100 единиц. Какой шаг покажется оптимальным, тот и оставьте.

Теперь укажем acpi использовать наши скрипты:

и сделаем эти скрипты исполняемыми:

Чтобы автоматически подбирать яркость при работе от аккумулятора или же сети, установим laptop-mode-tools:

и немного изменим его настройки:

Разумеется, значения 700/2000/3000 и путь /sys/class/backlight/intel_backlight/brightness должны быть заменены на ваши значения.

Автогибернация при критическом уровне заряда батареи

Достаточно часто бывает такое, что при работе от батареи забываешь посматривать на уровень её заряда, в результате чего получаешь отключение машины при полной разрядке батареи. Внезапное — как хлопок — выключение и все несохранённые данные потеряны. Обидно, не правда ли? Поэтому неплохо было бы позаботиться о своевременных мерах предосторожности.

Для этих целей также будем использовать функционал laptop-mode.

Если вас не устраивают значения по умолчанию, вы также можете изменить их. В случае, если до этого момента у вас не был указан раздел swap, укажите его в grub2, эти настройки уже были даны выше:

где /dev/sda5 — ваш swap-раздел Кроме того, в случае с archlinux следует добавить хук suspend в /etc/mkinitcpio.conf :

и пересобрать initrd:

Регулировка звука

Для этого снова обратимся к скриптам acpi, как и в случае с управлением яркостью дисплея.

Делаем скрипты в actions исполняемыми:

Для корректного распознавания мультимедийных клавиш, лучше использовать утилиту xmodmap .

Acpi и события клавиш

Честно говоря, меня устраивает поведение по-умолчанию, поэтому с пристрастием этот вопрос не рассматривался. При закрытии крышки ноутбука машина переходит в режим гибернации. При нажатии кнопки питания — корректно отключает систему. Оно и хорошо.

Похоже, управление этими событиями тоже берёт на себя laptop-mode-tools ( только пока неясно, в каком модуле/скрипте лежат эти настройки), поскольку в /etc/acpi/handler.sh каких-либо действий на события не назначено.

Но таки рассмотрим как настраивать то или иное событие.

Читайте также:  Windows 10 пропадает экранная клавиатура

Ответственен за эти шаманские действа вышеупомянутый handler.sh (или default.sh в зависимости от используемого дистрибутива), где и прописываются настройки. В случае, если вам хочется использовать не команду, а скрипт, расположите его в отдельном файле, подобно тому, как выше настраивалось управление яркостью дисплея и уровнем громкости .

Пример из дефолта:

button/lid указывает на управление закрытием/открытием крышки ноутбука, пока здесь нет ничего интересного.

Пример с воспроизведением звукового файла при закрытии/открытии крышки ноутбука:

То есть для настройки события нужно добавить его команду в соответствующее поле ( здесь после logger ‘LID closed’ ). Так, действие при открытии крышки нужно будет вписать после logger ‘LID opened’ .

  • button/power — события, связанные с кнопкой управления питанием
  • logger ‘PowerButton pressed’ — когда клавиша нажата
  • button/sleep — сон, если подобная кнопка/клавиша имеется
  • ac_adapter — события, связанные с подключением/отключением адаптера питания
  • logger ‘AC unpluged’ — когда адаптер отключен
  • logger ‘AC pluged’ — когда адаптер подключен
  • battery — батарея ноутбука
  • button/lid — крышка ноутбука

Для перевода в ждущий/спящий режимы можно использовать скрипты laptop-mode-tools из /usr/share/laptop-mode-tools/module-helpers : pm-hibernate и pm-suspend .

Для выключения питания при закрытии крышки достаточно добавить в /etc/acpi/actions/lm_lid.sh строку:

Помимо всего вышеописанного мы можем контролировать парковку головок жёсткого диска. Дабы отключить парковку совсем пропишите в /etc/laptop-mode/laptop-mode.conf :

Пожалуй, на этом стоит остановиться и дать читателю возможность самостоятельно поэкспериментировать с настройками энергосбережения и событий acpi.

Источник

What is acpi linux

ACPI (Advanced Configuration and Power Management Interface) is a power management system that is part of the BIOS.

Contents

Installation

Kernel

The following kernel options need to be activated for ACPI:

Optional drivers
Option Module Recommend Description
Deprecated /proc/acpi files No Creates deprecated files in the procfs filesystem, which are now replaced by files in the sysfs filesystem.
Deprecated power /proc/acpi directories No Creates deprecated files in the procfs filesystem, which are now replaced by files in the sysfs filesystem.
EC read/write access through /sys/kernel/debug/ec ec-debugfs No Debug interface to the Embedded Controller.
Deprecated /proc/acpi/event support No Creates deprecated files in the procfs filesystem, which are now replaced by the input layer or netlink events.
AC Adapter ac Laptops Creates files to tell, if your system is connected to AC.
Battery battery Laptops Creates files to tell, if your system is powered by a battery.
Button button Handles events on the power, sleep, and lid buttons.
Video video Supports basic operations for Video cards.
Fan fan Supports ACPI fan devices, allowing user-mode applications to perform basic fan control (on, off, status).
Dock dock Supports ACPI-controlled docking stations and removable drive bays, see the acpi dock article.
Processor processor Installs ACPI as the idle handler for Linux and uses ACPI C2 and C3 processor states to save power.
Processor Aggregator processor-aggregator ACPI 4.0 function to perform specific processor configuration and control.
Thermal Zone thermal Yes Supports ACPI thermal zones to protect your processor against overheating.
NUMA support
Debug Statements No
PCI slot detection driver pci-slot No Helps to correlate PCI bus addresses with physical slots
Container and Module Devices container Supports ACPI Container and Module devices to hotplug nodes, CPUs, and memory.
Smart Battery System sbs, sbshc Supports another type of access to battery information, found on some laptops.
Hardware Error Device hed Supports the Hardware Error Device, which is used to report some hardware errors.
Allow ACPI methods to be inserted/replaced at run time custom-method No
ACPI Platform Error Interface (APEI) APEI allows to report errors (for example from the chipset) to the operating system.
Читайте также:  Linux для дома что выбрать

Emerge

Desktop environments react on the common events generated by ACPI. If a desktop environment is not installed or to have the system react on special events the ACPI package can be installed. Install the sys-power/acpid package:

USE flags

Several packages know about the global acpi USE flag. There are no use flags available for sys-power/acpid at this time.

SELinux

For acpid to be able to shutdown a SELinux system, make sure the sec-policy/selinux-shutdown package is installed and the /sbin/shutdown executable is re-labelled:

Configuration

The scripts found in /etc/acpi define how the system reacts on ACPI events. They can be edited as necessary to meet the user’s needs.

Services

OpenRC

The acpid service can now be started. While using OpenRC run:

To have the acpid service start at boot time add it to the default runlevel:

systemd

If systemd is being used as the init system, enable the acpid service on system boot by issuing:

To start the service now:

Advanced examples

The default ACPI setup may be satisfactory for some users, however a little extra configuration may be required to get the acpid daemon to treat some basic ACPI events properly (AC power plug in/out, multimedia keys, etc.).

Modifications can be make to /etc/acpi/default.sh along with /etc/acpi/events/default if necessary. Why not create a complicated setup that makes use of the /etc/acpi/actions and /etc/acpi/events capabilities? Simply put scripts and event files in those locations for advanced usage.

A basic default.sh file will probably be enough for most users, however the following is an example of what could be done using default.sh :

Userspace utilities

Many packages use ACPI functions. A few are listed here:

  • sys-power/acpi: to show information from the /proc filesystem, such as battery status or thermal information
  • sys-power/acpitool: a small command line application, intended to be a replacement for the apm tool
  • sys-power/acpilight: replacement for xbacklight that uses the ACPI interface to set brightness
  • app-laptop/laptop-mode-tools: linux kernel laptop_mode user-space utilities
  • x11-misc/cbatticon: a lightweight and fast battery icon that sits in your system tray
  • app-admin/conky: an advanced, highly configurable system monitor for X

Источник

Оцените статью