Package: hibernate
Version: 1.94-2
Severity: normal
Tags: patch

I have a new approach for getting suspend to ram working on my p7120
lifebook. Stockholm suggested that simply dumping a file from proc before
suspend and loading it afterwards worked better than using vbetool
(which fails to turn the backlight back on on this laptop). I believe
that the /proc file contains the first part of the video memory, so
loading it resets the video card to the pre-suspend state. Or destroys
your machine, if you're unlucky, but it works well for me. ;-)

I've attached a scriptlet I wrote to do this, and it can be enabled as
follows:

# Dump video card memory. If vbetool doesn't work this just might. Or it
# might hose your machine, so use with caution. Do not enable this
# option and Vbetool at the same time.
EnableVideoDump yes


(PS, is the s2ram -n in the info below supposed to print the help text?)

-- Package-specific info:

--- configuration
==> /etc/hibernate/common.conf <==
Verbosity 0
LogFile /var/log/hibernate.log
LogVerbosity 1
Distribution debian
XDisplay :0
SaveClock restore-only
Runi915resolution yes
UnloadModules ata_piix mmc_core
UnloadBlacklistedModules yes
LoadModules auto
PauseAudio yes
SwitchToTextMode yes
XStatus x
XmessageDisable yes
XosdSettings --font '-misc-fixed-medium-r-semicondensed--*-120-*-*-c-*-*-*' 
--colour=Green --shadow 1 --pos top --align center --offset 0
==> /etc/hibernate/disk.conf <==
TryMethod ususpend-disk.conf
TryMethod sysfs-disk.conf
==> /etc/hibernate/hibernate.conf <==
TryMethod ram.conf
==> /etc/hibernate/ram.conf <==
TryMethod sysfs-ram.conf
EnableVideoDump yes
==> /etc/hibernate/suspend2.conf <==
UseSuspend2 yes
Reboot no
EnableEscape yes
DefaultConsoleLevel 1
Compressor lzf
Encryptor none
FullSpeedCPU yes
Include common.conf
==> /etc/hibernate/sysfs-disk.conf <==
UseSysfsPowerState disk
Include common.conf
==> /etc/hibernate/sysfs-ram.conf <==
UseSysfsPowerState mem
Include common.conf
==> /etc/hibernate/ususpend-both.conf <==
USuspendMethod both
Include common.conf
==> /etc/hibernate/ususpend-disk.conf <==
USuspendMethod disk
Include common.conf
==> /etc/hibernate/ususpend-ram.conf <==
USuspendMethod ram
Include common.conf

--- /sys/power
==> /sys/power/disk <==
shutdown
==> /sys/power/image_size <==
524288000
==> /sys/power/resume <==
0:0
==> /sys/power/state <==
mem disk 

--- s2ram -n
Usage: s2ram [-nhi] [-fspmra]

Options:
    -h, --help:       this text.
    -n, --test:       test if the machine is in the database.
                      returns 0 if known and supported
    -i, --identify:   prints a string that identifies the machine.
    -f, --force:      force suspending, even on unknown machines.

the following options are only available with --force:
    -s, --vbe_save:   save VBE state before suspending and restore after resume.
    -p, --vbe_post:   VBE POST the graphics card after resume
    -m, --vbe_mode:   get VBE mode before suspend and set it after resume
    -r, --radeontool: turn off the backlight on radeons before suspending.
    -a, --acpi_sleep: set the acpi_sleep parameter before suspend
                      1=s3_bios, 2=s3_mode, 3=both

--- log
hibernate.log file not readable.

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-686
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages hibernate depends on:
ii  console-tools              1:0.2.3dbs-65 Linux console and font utilities

Versions of packages hibernate recommends:
ii  dash                          0.5.3-7    The Debian Almquist Shell
ii  hdparm                        6.9-1      tune hard disk parameters for high
ii  uswsusp                       0.5-1      tools to use userspace software su
ii  vbetool                       0.7-1.1    run real-mode video BIOS code to a

-- no debconf information

-- 
see shy jo
# -*- sh -*-
# vim:ft=sh:ts=8:sw=4:noet
# VideoBumo scriptlet
#
# This scriptlet Copyright (C) Cameron Patrick, 2005, Joey Hess 2007 and may be
# used under the same terms as hibernate-script itself.

AddConfigHandler VideoDumpOptions
AddConfigHelp "EnableVideoDump <boolean>" "Dump and load video card memory 
before and after suspending."

# hopefully this is a good choice and nothing else uses it :-/
VIDEODUMP_VT=62
VIDEODUMP_ENABLED=
VIDEODUMP_ID=

VideoDumpSaveState() {
    # if we're switched off, don't do nuffin
    [ x"$VIDEODUMP_ENABLED" = "x1" ] || return 0

    # save our previous VT and switch to a new one
    VIDEODUMP_ORIG_VT=`fgconsole 2>/dev/null` || VIDEODUMP_ORIG_VT=1
    chvt $VIDEODUMP_VT
    TERM=linux tput clear 
    VIDEODUMP_FILE=`mktemp /tmp/tmp.hibernate.XXXXXX`

    VIDEODUMP_ID=`lspci | grep VGA | awk '{ print $1 }' | sed -e '[EMAIL 
PROTECTED]:@@' -e 's@:@/@'` || true
    if [ -e "/proc/bus/pci/$VIDEODUMP_ID" ]; then
        cat "/proc/bus/pci/$VIDEODUMP_ID" > "$VIDEODUMP_FILE"
    fi

    echo $VIDEODUMP_ID
    echo $VIDEODUMP_FILE

    return 0
}

VideoDumpRestoreState() {
    # if we're switched off, don't do nuffin
    [ x"$VIDEODUMP_ENABLED" = "x1" ] || return 0

    # Restore a saved state.
    if [ -n "$VIDEODUMP_FILE" ] && [ -e "/proc/bus/pci/$VIDEODUMP_ID" ]; then
        cat "$VIDEODUMP_FILE" > /proc/bus/pci/$VIDEODUMP_ID
        rm -f "$VIDEODUMP_FILE"
    fi

    # change back to our original VT
    chvt $VIDEODUMP_ORIG_VT
}

VideoDumpOptions() {
    case $1 in
        enablevideodump)
            BoolIsOn "$1" "$2" && VIDEODUMP_ENABLED=1 || return 0
            ;;
        *)
            return 1
    esac

    if [ -z "$VIDEODUMP_HOOKED" ] ; then
        AddSuspendHook 97 VideoDumpSaveState
        AddResumeHook 97 VideoDumpRestoreState
        VIDEODUMP_HOOKED=1
    fi

    return 0
}

# $Id: $

Attachment: signature.asc
Description: Digital signature

Reply via email to