ACPI で遊んでみたメモ。 とりあえず Linux ACPI-HOWTO と同じことをやってみる。 http://www.linux.or.jp/JF/JFdocs/ACPI-HOWTO.html でも所どころ記述と合わない。 CONFIG_ACPI_INTERPRETER なんて無いし。 ここから始まる thread も参照。 http://search.luky.org/linux-users.9/msg00569.html < dmesg > 以下 demsg | grep ACPI したもの。 BIOS-e820: 0000000006ff0000 - 0000000006fffc00 (ACPI data) BIOS-e820: 0000000006fffc00 - 0000000007000000 (ACPI NVS) tbxface-0099 [01] Acpi_load_tables : ACPI Tables successfully loaded ACPI Namespace successfully loaded at root c032a320 ACPI: Core Subsystem version [20011018] evxfevnt-0081 [02] Acpi_enable : Transition to ACPI mode successful Executing device _INI methods:................[ACPI Debug] String: LNK2_STA .[ACPI Debug] String: LNK3_STA .[ACPI Debug] String: LNK4_STA .[ACPI Debug] String: LNK5_STA .[ACPI Debug] String: LNK6_STA .[ACPI Debug] String: LNK7_STA .[ACPI Debug] String: LNK8_STA ACPI: Subsystem enabled [ACPI Debug] String: LNK2_STA [ACPI Debug] String: LNK2_STA [ACPI Debug] String: LNK2_STA [ACPI Debug] String: LNK3_STA [ACPI Debug] String: LNK3_STA [ACPI Debug] String: LNK3_STA [ACPI Debug] String: LNK4_STA [ACPI Debug] String: LNK4_STA [ACPI Debug] String: LNK4_STA [ACPI Debug] String: LNK5_STA [ACPI Debug] String: LNK5_STA [ACPI Debug] String: LNK5_STA [ACPI Debug] String: LNK6_STA [ACPI Debug] String: LNK6_STA [ACPI Debug] String: LNK6_STA [ACPI Debug] String: LNK7_STA [ACPI Debug] String: LNK7_STA [ACPI Debug] String: LNK7_STA [ACPI Debug] String: LNK8_STA [ACPI Debug] String: LNK8_STA [ACPI Debug] String: LNK8_STA ACPI: System firmware supports S0 S3 S4 S5 ACPI: AC Adapter found ACPI: Power Button (FF) found ACPI: Multiple power buttons detected, ignoring fixed-feature ACPI: Power Button (CM) found ACPI: Sleep Button (CM) found ACPI: Lid Switch (CM) found < install > acpid と pmtools を入れる。 手元の kernel configure 時には AML という言葉は見掛けなかったんだけど 見落としたかな。 分からないので current を持って来る。 rin@maaya[~/cmp]% wget http://phobos.fs.tum.de/acpi/download/acpid-20010510.tar.gz && wget http://phobos.fs.tum.de/acpi/download/pmtools-060600.tar.gz rin@maaya[~/cmp]% tar xzf acpid-20010510.tar.gz -C ~/usr/local/ rin@maaya[~/cmp]% tar xzf pmtools-060600.tar.gz -C ~/usr/local/ まずは acpid rin@maaya[~/cmp]% cd ~/usr/local/acpid-20010510/ rin@maaya[~/usr/local/acpid-20010510]% make Makefile には install のルールが書いてないので手動で cp する。 rin@maaya[~/usr/local/acpid-20010510]% su bash-2.04# cp acpid /usr/sbin/ bash-2.04# /usr/sbin/acpid & 動いた。 bash-2.04# ps aux | grep acpid root 607 0.0 0.3 1196 364 ? S 19:49 0:00 /usr/sbin/acpid root 608 0.0 0.3 1196 348 ? S 19:49 0:00 /usr/sbin/acpid [1]+ Done /usr/sbin/acpid 続いて pmtools 。 rin@maaya[~/usr/local/acpid-20010510]% cd ../pmtools/ rin@maaya[~/usr/local/pmtools]% make こちらも手動で cp する。 rin@maaya[~/usr/local/pmtools]% su bash-2.04# cp acpianalyze/acpianalyze /usr/local/bin bash-2.04# cp acpidisasm/acpidisasm /usr/local/bin bash-2.04# cp acpidmp/acpidmp acpidmp/acpitbl acpidmp/acpixtract /usr/local/bin bash-2.04# cp pmtest/pmtest /usr/local/bin /var/log/message を見ると ACPI が動作してるらしいことが分かる。 bash-2.04# grep ACPI /var/log/messages Mar 10 07:01:28 maaya kernel: ACPI: Core Subsystem version [20011018] Mar 10 07:01:28 maaya kernel: ACPI: Subsystem enabled Mar 10 07:01:28 maaya kernel: ACPI: AC Adapter found Mar 10 07:01:28 maaya kernel: ACPI: Power Button (FF) found Mar 10 07:01:28 maaya kernel: ACPI: Power Button (CM) found Mar 10 07:01:28 maaya kernel: ACPI: Sleep Button (CM) found Mar 10 07:01:28 maaya kernel: ACPI: Lid Switch (CM) found acpidmp してみる。 何が書いてあるのかさっぱり分からない。 bash-2.04# acpidmp RSDP "PTLTD" @ 0x000f82d0 0000: 52 53 44 20 50 54 52 20 ff 50 54 4c 54 44 20 00 RSD PTR .PTLTD . 0010: 70 c5 ff 06 p... RSDT @ 0x06ffc570 0000: 52 53 44 54 28 00 00 00 01 8a 50 54 4c 54 44 20 RSDT(.....PTLTD 0010: 20 20 52 53 44 54 20 20 05 00 04 06 20 4c 54 50 RSDT .... LTP 0020: 00 00 00 00 8c fb ff 06 ........ FACP @ 0x06fffb8c 0000: 46 41 43 50 74 00 00 00 01 78 54 4d 45 54 41 20 FACPt....xTMETA 0010: 50 44 42 2e 41 4c 49 20 05 00 04 06 50 54 4c 20 PDB.ALI ....PTL 0020: 40 42 0f 00 c0 ff ff 06 98 c5 ff 06 00 00 09 00 @B.............. bash-2.04# acpidmp FACP | acpidisasm 00000000: OnesOp 00000001: OnesOp 00000001: OnesOp : : 以下出力が延々と続く。 bash-2.04# acpitbl /proc/acpi/dsdt Signature: DSDT Length: 13812 Revision: 0x01 Checksum: 0xfc OEMID: TM OEM Table ID: PDBALI35 OEM Revision: 0x06040005 Creator ID: MSFT Creator Revision: 0x0100000b bash-2.04# acpidmp FACP | acpitbl Signature: FACP Length: 116 Revision: 0x01 Checksum: 0x78 OEMID: TMETA OEM Table ID: PDB.ALI OEM Revision: 0x06040005 Creator ID: PTL Creator Revision: 0x000f4240 FIRMWARE_CTRL: 0x06ffffc0 DSDT: 0x06ffc598 INT_MODEL: 0x00 SCI_INT: 9 SMI_CMD: 0x000000b1 ACPI_ENABLE: 0xf0 ACPI_DISABLE: 0xf1 S4BIOS_REQ: 0xf2 PM1a_EVT_BLK: 0x00008000 PM1b_EVT_BLK: 0x00000000 PM1a_CNT_BLK: 0x00008004 PM1b_CNT_BLK: 0x00000000 PM2_CNT_BLK: 0x00008030 PM_TMR_BLK: 0x00008008 GPE0_BLK: 0x00008018 GPE1_BLK: 0x00000000 PM1_EVT_LEN: 4 PM1_CNT_LEN: 2 PM2_CNT_LEN: 1 PM_TM_LEN: 4 GPE0_BLK_LEN: 16 GPE1_BLK_LEN: 0 GPE1_BASE: 0 P_LVL2_LAT: 10 P_LVL3_LAT: 32 FLUSH_SIZE: 0 FLUSH_STRIDE: 0 DUTY_OFFSET: 1 DUTY_WIDTH: 3 DAY_ALRM: 0x0d MON_ALRM: 0x00 CENTURY: 0x32 Flags: 0x00000000 bash-2.04# cat /proc/interrupts CPU0 0: 4701345 XT-PIC timer 1: 3624 XT-PIC keyboard 2: 0 XT-PIC cascade 4: 1 XT-PIC Texas Instruments PCI1420 (#2) 5: 0 XT-PIC Texas Instruments PCI1420 9: 137 XT-PIC acpi 11: 10892 XT-PIC eth0 14: 10660 XT-PIC ide0 NMI: 0 LOC: 0 ERR: 0 MIS: 0 bash-2.04# < event > event を見てみる。 acpid を実行してない状態。 bash-2.04# cat /proc/acpi/event button lid 00000080 00000000 ← 蓋を閉じた button lid 00000080 00000000 button power 00000080 00000000 ← 電源スイッチを押した button power 00000080 00000000 ← 電源スイッチを押した button power 00000080 00000000 ← 電源スイッチを押した 一般的に Note PC は電源を切るときは電源スイッチを 3 秒ほど押し続ける。 といっても手元にある VAIO Z505 と FIVA 206VL での動作だけど。 上の出力は一瞬だけ押し込んだ状態。 ずーっと押してると電源切れちゃうからね。 acpid を起動する。 -d を付けて実行すると foreground で起動する。 今度は event は見ない。 蓋を閉じてみる。 bash-2.04# acpid -d acpid: lid button pressed acpid: Lid closed. No action yet. acpid: lid button pressed acpid: Lid closed. No action yet. acpid: exiting bash-2.04# 僕が行った「蓋を閉じる」動作は 1 度だけなのだけど 閉じてる間これが出力されるようだ。 電源スイッチを試すと 「 1 瞬押す」という動作を 2 回やるとほんとに電源が落ちる。 電源を押すと shutdown のシーケンスが始まるので これはこれで正常なのかな。 < sleep > sleep させるには以下を実行すれば良いと HOWTO には書いてある。 bash-2.04# echo 1 > /proc/acpi/sleep でも sleep しない。 これは田原さんの報告と同じっすね。 < power > acpid 起動させる。 電源差してるとき。 rin@maaya[~]% cat /proc/acpi/ac_aadapter/0/status Status: off-line 電源抜いたとき。 rin@maaya[~]% cat /proc/acpi/ac_aadapter/0/status Status: off-line 電源ひっこ抜いても変わらない。はて < shutdown > acpid を起動してないときと起動してるときで 以下がそれぞれ期待どーりに動作することを確認。 shutdown -h now shutdown -r now < battery > rin@maaya[~]% ls -a /proc/acpi/battery/ ./ ../ 何もない。 どーするんだろう。