2 # Copyright 2009 Nicolas Bigaouette
3 # This file is part of acpi-eeepc-generic.
4 # http://code.google.com/p/acpi-eeepc-generic/
6 # acpi-eeepc-generic is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # acpi-eeepc-generic is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with acpi-eeepc-generic. If not, see <http://www.gnu.org/licenses/>.
19 .
/etc
/acpi
/eeepc
/acpi-eeepc-generic-functions.sh
21 # Make sure we run as root
22 if [[ $EUID -ne 0 ]]; then
23 me
="`dirname $0`/`basename $0`"
28 logger
"#############################################"
29 logger
"acpi-eeepc-generic-suspend2ram.sh:"
31 if [ -e "${EEEPC_VAR}/power.lock" ]; then
32 msg
="Suspend lock exist, canceling suspend"
33 logger
"$msg (${EEEPC_VAR}/power.lock)"
34 eeepc_notify
"$msg" stop
5000
38 vga_is_on
=`xrandr | grep -A 1 VGA | grep "*"`
39 if [ "x$vga_is_on" != "x" ]; then
40 msg
="VGA is up and running, canceling suspend"
42 eeepc_notify
"$msg" stop
5000
46 if grep -q mem
/sys
/power
/state
; then
48 # BEGIN SUSPEND SEQUENCE
50 logger
"Start suspend sequence"
52 if [[ "$SUSPEND_QUIRKS_VTSWITCH" == "yes" ]]; then
54 CONSOLE_NUMBER
=$
(fgconsole
)
55 logger
"Saving console number: $CONSOLE_NUMBER"
57 # Turn off external monitor
58 var_xrandr
="$EEEPC_VAR/xrandr.log"
60 name_lvds
=$
(grep -i connected
$var_xrandr |
grep -i lvds |
awk '{print ""$1""}')
61 if [ "x`grep " connected
" $var_xrandr | awk '{print ""$1""}' | grep -i VGA`" != "x" ]; then
62 name_vga
=$
(grep -i connected
$var_xrandr |
grep -i vga |
awk '{print ""$1""}')
63 xrandr
--output ${name_lvds} --preferred --output ${name_vga} --off
66 # Change virtual terminal to not screw up X
71 /etc
/rc.d
/logsbackup stop
77 execute_commands
"${SUSPEND2RAM_COMMANDS[@]}"
79 logger
"BEGIN WAKEUP SEQUENCE..."
82 #/usr/sbin/vbetool post
84 if [[ "$SUSPEND_QUIRKS_VTSWITCH" == "yes" ]]; then