Before changing your ACPI scripts, you can first test that script to see if it does what you want. Save this in your home directory as a file called sleep.sh
Code: Select all
#!/bin/bash
FGCONSOLE=`fgconsole`
chvt 8
sync
hwclock --systohc
echo -n "mem" > /sys/power/state
hwclock --hctosys
vbetool post
if [ "$FGCONSOLE" -ge "7" ] ; then
chvt $FGCONSOLE
else
chvt 7
chvt $FGCONSOLE
fi
Then open a terminal and test with
Now, this script looks like it sleeps (echoing only mem into /sys/power/state) and wakes up by switching you to the 7th virtual term. You should be able to do the same by pressing Ctrl, Alt, and F7 simultaneously (changing to virtual term 7) when the screen is black after resume. But maybe the magic is in the vbetool line.
Anyway, if the script is in fact what you want, you'll need to edit the acpi scripts. Unlike the distribution used in that Think Wiki excerpt, Debian-based distributions (like Ubuntu) keep their acpi scripts in /etc/acpi.
Your current /etc/acpi/sleep.sh should look something like this:
Code: Select all
#!/bin/sh
test -f /usr/share/acpi-support/power-funcs || exit 0
. /etc/default/acpi-support
. /usr/share/acpi-support/power-funcs
. /usr/share/acpi-support/device-funcs
. /usr/share/acpi-support/policy-funcs
DeviceConfig;
if [ x$ACPI_SLEEP != xtrue ] && [ x$1 != xforce ]; then
exit;
fi
# If gnome-power-manager or klaptopdaemon are running, let them handle policy
if [ x$1 != xforce ] && [ x$1 != xsleep ] && [ `CheckPolicy` = 0 ]; then
exit;
fi
if [ x$LOCK_SCREEN = xtrue ]; then
if pidof xscreensaver > /dev/null; then
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
getXuser;
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
. /usr/share/acpi-support/screenblank
fi
done
fi
fi
# Generic preparation code
. /etc/acpi/prepare.sh
if [ x$DISABLE_DMA = xtrue ] && [ -b /dev/hda ]; then
hdparm -d 0 /dev/hda
fi
echo -n $ACPI_SLEEP_MODE >/sys/power/state
if [ x$RESET_DRIVE = xtrue ] && [ -b /dev/hda ]; then
hdparm -w /dev/hda
hdparm -C /dev/hda
hdparm -C /dev/hda
hdparm -C /dev/hda
hdparm -d 1 /dev/hda
fi
if [ x$DISABLE_DMA = xtrue ] && [ -b /dev/hda ]; then
hdparm -d 1 /dev/hda
fi
# Generic wakeup code
. /etc/acpi/resume.sh
You could change it to something like this :
(simplified and with changes commented with ##. You do not need the original's if loops if you are never past the 7th virtual terminal with regular use, and you're probably not.)
Code: Select all
#!/bin/sh
test -f /usr/share/acpi-support/power-funcs || exit 0
. /etc/default/acpi-support
. /usr/share/acpi-support/power-funcs
. /usr/share/acpi-support/device-funcs
. /usr/share/acpi-support/policy-funcs
DeviceConfig;
if [ x$ACPI_SLEEP != xtrue ] && [ x$1 != xforce ]; then
exit;
fi
# If gnome-power-manager or klaptopdaemon are running, let them handle policy
if [ x$1 != xforce ] && [ x$1 != xsleep ] && [ `CheckPolicy` = 0 ]; then
exit;
fi
if [ x$LOCK_SCREEN = xtrue ]; then
if pidof xscreensaver > /dev/null; then
for x in /tmp/.X11-unix/*; do
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
getXuser;
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
. /usr/share/acpi-support/screenblank
fi
done
fi
fi
# Generic preparation code
. /etc/acpi/prepare.sh
if [ x$DISABLE_DMA = xtrue ] && [ -b /dev/hda ]; then
hdparm -d 0 /dev/hda
fi
echo -n $ACPI_SLEEP_MODE >/sys/power/state
if [ x$RESET_DRIVE = xtrue ] && [ -b /dev/hda ]; then
hdparm -w /dev/hda
hdparm -C /dev/hda
hdparm -C /dev/hda
hdparm -C /dev/hda
hdparm -d 1 /dev/hda
fi
if [ x$DISABLE_DMA = xtrue ] && [ -b /dev/hda ]; then
hdparm -d 1 /dev/hda
fi
## per ThinkWiki article
vbetool post
## force virtual term 7 (GUI) per ThinkWiki article
chvt 7
# Generic wakeup code
. /etc/acpi/resume.sh
Alternatively you could stick those changes in resume.sh
Hope this helps.