用了四年的笔记本电池报废了,最近刚换了一块电池。为了延长电池使用寿命,我开启了Linux的自动挂起功能。
但是系统挂起之后,无意间触碰到鼠标会导致系统意外唤醒,这真要命!

解决方法:
修改/proc/acpi/wakeup文件,将XHCEHC1EHC2USB相关的项目设置为disabled状态。
需要su权限。
Linux-wakeup.png

关于其中Device符号的解答,来自stackexchange

PS2K: PS/2 keyboard
PS2M: PS/2 mouse
PWRB or PBTN: Power button
LID: Laptop lid
RP0x or EXPx: PCIE slot #x (aka PCI Express Root Port #x)
EHCx or USBx: USB 2.0 (EHCI) chip
XHC: USB 3.0 (XHCI) chip
PEGx: PCI Express for Graphics slot #x
GLAN: Gigabit Ethernet

HDEF most probably means “High definition”, so it’s likely to be the integrated audio device and IGBE could stand for “Intel Gigabit Ethernet” or “Integrated Gigabit Ethernet”, so it should be the Ethernet LAN controller..

无法直接编辑/proc/acpi/wakeup的问题,请使用以下方式进行修改状态:

1
echo 'XHC' >  /proc/acpi/wakeup

但是这种方式会再重启之后失效,需建立一个开机执行的脚本。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
# @Author: lance
# @Date: 2015-10-07 22:38:51
# @Last Modified by: lance
# @Last Modified time: 2015-10-07 22:42:21
#
# Some events will wakeup right after suspend, disable them
stat=$(cat /proc/acpi/wakeup)
wakers=(IGBE EXP2 XHCI EHC1)
for waker in ${wakers[@]}; do
is_en=$(echo "${stat}" | grep $waker | grep disabled);
if [ -z "$is_en" ]; then
echo disable wakeup of $waker...
echo $waker | tee /proc/acpi/wakeup;
fi
done

https://unix.stackexchange.com/questions/236127/acpi-wakeup-4-letters-code-meaning
http://ju.outofmemory.cn/entry/336106