ACPI/ja

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page ACPI and the translation is 92% complete.
Resources

ACPI (Advanced Configuration and Power Management Interface) は、BIOS の一部である電源管理システムです。

インストール

カーネル

ACPIでは、次のカーネルオプションをアクティブにする必要があります:

カーネル
Power management and ACPI options  --->
    [*] Power Management support
        [*] ACPI (Advanced Configuration and Power Interface) Support  --->
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 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 フラグ

一部のパッケージはグローバルな acpi USE フラグを関知します。現時点では sys-power/acpid で利用可能な use フラグはありません。

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 サービスを開始させるには、default ランレベルに追加してください:

root #rc-update add acpid default

systemd

systemd を init システムとして使用している場合は、以下を実行して acpid サービスをシステム起動時に有効化してください:

root #systemctl enable acpid.service

すぐにサービスを開始するには:

root #systemctl start acpid.service

高度な例

一部のユーザーにはデフォルトのACPIセットアップで十分な場合がありますが、acpidデーモンにいくつかの基本的なACPIイベント(AC電源プラグイン/アウト、マルチメディアキーなど)を適切に処理させるために、少し追加の構成が必要になる場合があります。

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:

ファイル /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:
注意
上のスクリプトは ALSAOSS の両方に対応しているので、OSS から ALSA へ、あるいはその逆に切り換えたとき、追加の操作は必要ありません。スクリプトは自由に編集してください!
注意
上のスクリプトは、hprofile を利用した電源管理プロファイルを利用しています。さらなる情報はについては hprofile の記事を確認してください。

関連項目