我刚刚从 Windows 8 切换到 Ubuntu 13.04,我对这个操作系统很陌生。当我通过合上笔记本电脑盖让电脑进入睡眠状态(挂起)时,它似乎只是关闭电脑,而不是进入待机状态并保留我打开的程序。我应该怎么做才能解决这个问题?顺便说一句,我已经检查了电源设置,那里的一切似乎都很好,理论上不应该发生这种情况。[PS 我有一台索尼 VAIO VGN-NW150J]
答案1
转到系统设置(通常位于 Dock 上,或者转到仪表板并输入“系统设置”),然后转到电源,并将“当盖子关闭时”选项更改为暂停。
答案2
打开终端并输入:
gksudo gedit /etc/pm/sleep.d/20_custom-ehci_hcd
然后会打开一个空的文本文件。将以下代码粘贴到文件中:
VERSION=1.1
DEV_LIST=/tmp/usb-dev-list
DRIVERS_DIR=/sys/bus/pci/drivers
DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
HEX="[[:xdigit:]]"
MAX_BIND_ATTEMPTS=2
BIND_WAIT=0.1
unbindDev() {
echo -n > $DEV_LIST 2>/dev/null
for driver in $DRIVERS; do
DDIR=$DRIVERS_DIR/${driver}_hcd
for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do
echo -n "$dev" > $DDIR/unbind
echo "$driver $dev" >> $DEV_LIST
done
done
}
bindDev() {
if [ -s $DEV_LIST ]; then
while read driver dev; do
DDIR=$DRIVERS_DIR/${driver}_hcd
while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do
echo -n "$dev" > $DDIR/bind
if [ ! -L "$DDIR/$dev" ]; then
sleep $BIND_WAIT
else
break
fi
MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))
done
done < $DEV_LIST
fi
rm $DEV_LIST 2>/dev/null
}
case "$1" in
hibernate|suspend) unbindDev;;
resume|thaw) bindDev;;
esac
然后保存文件退出文本编辑器并在终端中输入以下内容:
sudo chmod 755 /etc/pm/sleep.d/20_custom-ehci_hcd