ACPI/ru
ACPI (Advanced Configuration and Power Management Interface – усовершенствованный интерфейс управления конфигурацией и питанием) – это система управления питанием, являющаяся частью BIOS.
Установка
Ядро
Не обходимо включить следующие опции ядра для ACPI:
Power management and ACPI options ---> [*] Power Management support [*] ACPI (Advanced Configuration and Power Interface) Support --->
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 graphics adapters. |
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. |
Emerge
Окружение рабочего стола реагирует на общие события, генерируемые ACPI. В случае если окружение рабочего стола не установлено и нужно или чтобы система реагировала на особые события, можно установить пакет ACPI. Установка пакета sys-power/acpid:
root #
emerge --ask sys-power/acpid
USE-флаги
Некоторые пакеты знают о глобальном USE-флаге acpi
. На данный момент нет каких-либо use-флагов для sys-power/acpid.
SELinux
Чтобы acpid мог выключить SELinux подсистему, убедитесь, что пакет sec-policy/selinux-shutdown установлен и испольняемый файл /sbin/shutdown перемаркирован:
root #
emerge --ask sec-policy/selinux-shutdown
Конфигурация
Скрипты, находящиеся в /etc/acpi определяют как система должна реагировать на события ACPI. Они могут быть отредактированы под потребности пользователя.
Сервисы
OpenRC
Сервис acpid теперь может быть запущен. В случае использования OpenRC запустите:
root #
/etc/init.d/acpid start
Добавьте сервис acpid на уровень запуска по умолчанию, чтобы сервис он запускался во время загрузки:
root #
rc-update add acpid default
systemd
В случае если systemd используется как система инициализцации, включите сервис acpid для запуска во время загрузки запустив:
root #
systemctl enable acpid.service
Чтобы запустить сервсис сейчас:
root #
systemctl start acpid.service
Расширенные примеры
Настройки ACPI по умолчанию могут быть удовлетворительными для некоторых пользователей, тем не менее небольшие дополнительные настройки могут быть необходимы чтобы демон acpid правильно обрабатывал некоторые базовые ACPI события (подключение/отключение источника бесперебойного питания, мультимедия кнопки и так далее).
При необходимости изменения могут быть внесены в /etc/acpi/default.sh вместе с /etc/acpi/events/default. Почему бы не создать сложную установку, использующую возможности /etc/acpi/actions и /etc/acpi/events? Просто добавьте сценарии и файлы событий в данные расположения для продвинутого использования.
Базового файла default.sh скорее всего будет достаточно для большинства пользователей, однако ниже представлен пример того, что может быть сделано с использованием default.sh:
/etc/acpi/default.sh
#!/bin/sh # # $Header: /etc/acpi/default.sh Exp $ # $Author: (c) 2012-2014 -tclover <tokiclover@dotfiles.> Exp $ # $License: MIT (or 2-clause/new/simplified BSD) Exp $ # $Version: 2014/12/24 21:09:26 Exp $ # log() { logger -p daemon "ACPI: $*"; } uhd() { log "event unhandled: $*"; } set $* group=${1%/*} action=${1#*/} device=$2 id=$3 value=$4 [ -d /dev/snd ] && alsa=true || alsa=false [ -d /dev/oss ] && oss=true || oss=false amixer="amixer -q set Master" ossmix="ossmix -- vmix0-outvol" case $group in ac_adapter) case $value in *0) log "switching to power.bat power profile" hprofile power.bat;; *1) log "switching to power.adp power profile" hprofile power.adp;; *) uhd $*;; esac ;; battery) case $value in *0) log "switching to power.adp power profile" hprofile power.adp;; *1) log "switching to power.adp power profile" hprofile power.adp;; *) uhd $*;; esac ;; button) case $action in lid) case "$id" in close) hibernate-ram;; open) :;; *) uhd $*;; esac ;; power) shutdown -H now;; sleep) hibernate-ram;; mute) $alsa && $amixer toggle;; volumeup) $alsa && $amixer 3dB+ $oss && $ossmix +3;; volumedown) $alsa && $amixer 3dB- $oss && $ossmix -3;; *) uhd $*;; esac ;; cd) case $action in play) :;; stop) :;; prev) :;; next) :;; *) uhd $*;; esac ;; jack) case $id in *plug) :;; *) uhd $*;; esac ;; video) case $action in displayoff) :;; *) uhd $*;; esac ;; *) uhd $*;; esac unset alsa oss amixer ossmix group action device id # vim:fenc=utf-8:ft=sh:ci:pi:sts=4:sw=4:ts=4:
Стоит отметить, что приведённый выше скрипт совместим и с ALSA, и с OSS, поэтому при переключении между ними никаких дополнительных действий не требуется. Не бойтесь редактировать скрипт!
Приведённый выше скрипт также использует профиль управления питанием с помощью hprofile. См. статью hprofile для получения дополнительных сведений.
Смотрите также
- ACPI/ThinkPad-special-buttons — describes how to configure ACPI events and actions for the Lenovo ThinkPad T410 laptop.
- Suspend and hibernate — describes how to suspend or hibernate a Gentoo system.