tags tags 433028 patch
thanks

also sprach Andrew Pimlott <[EMAIL PROTECTED]> [2007.07.13.2224 +0200]:
> One solution would be for hibernate to recognize the 0x20 exit status
> from "s2ram -n".  There could be an option "USuspendRamUnsureOk yes"
> that tells hibernate to proceed in this case, and not pass -f to s2ram.
> Just an idea, maybe you know a better way.

Good idea. I've implemented this; does the following patch work for
you?

Index: /home/madduck/debian/pkg/hibernate/upstream.trunk/scriptlets.d/ususpend
===================================================================
--- /home/madduck/debian/pkg/hibernate/upstream.trunk/scriptlets.d/ususpend     
(revision 1133)
+++ /home/madduck/debian/pkg/hibernate/upstream.trunk/scriptlets.d/ususpend     
(working copy)
@@ -6,6 +6,7 @@
 
 AddConfigHelp "USuspendMethod <disk|ram|both>" "Enables use of the uswsusp 
suspend method of newer kernels (>= 2.6.17rc1)"
 AddConfigHelp "USuspendRamForce <boolean>" "Passes the -f flag to s2ram to 
force suspending even if the machine is not recognised"
+AddConfigHelp "USuspendRamUnsureOk <boolean>" "Instructs s2ram to continue 
when it's unsure about the system type, thus not requiring -f to be passed"
 AddConfigHelp "USuspendRamVbeSave <boolean>" "Passes the -s flag to s2ram to 
save VBE state before suspending and restore after resume"
 AddConfigHelp "USuspendRamVbePost <boolean>" "Passes the -p flag to s2ram to 
VBE POST the graphics card after resume"
 AddConfigHelp "USuspendRamVbeMode <boolean>" "Passes the -m flag to s2ram to 
get VBE mode before suspend and set it after resume"
@@ -18,6 +19,7 @@
 USUSPEND_DEVICE=/dev/snapshot
 USUSPEND_PROG=s2disk
 USUSPEND_RAM_FORCE=0
+USUSPEND_RAM_UNSUREOK=0
 USUSPEND_RAM_VBESAVE=0
 USUSPEND_RAM_VBEPOST=0
 USUSPEND_RAM_VBEMODE=0
@@ -49,6 +51,9 @@
        ususpendramforce)
            BoolIsOn "$1" "$2" && USUSPEND_RAM_FORCE=1 || return 0
            ;;
+       ususpendramunsureok)
+           BoolIsOn "$1" "$2" && USUSPEND_RAM_UNSUREOK=1 || return 0
+           ;;
        ususpendramvbesave)
            BoolIsOn "$1" "$2" && USUSPEND_RAM_VBESAVE=1 || return 0
            ;;
@@ -96,9 +101,16 @@
            [ $USUSPEND_RAM_VBEMODE -eq 1 ] && ARGS="$ARGS -m"
            [ $USUSPEND_RAM_ACPISLEEP -ne 0 ] && ARGS="$ARGS -a 
$USUSPEND_RAM_ACPISLEEP"
        fi
-       vecho 1 "$EXE: Running $USUSPEND_PROG_PATH $ARGS ${FORCE:+$FORCE }..."
-       $USUSPEND_PROG_PATH $ARGS 2>&1 | vcat 2 \
-           || vecho 0 "$EXE: $USUSPEND_PROG_PATH failed."
+       vecho 1 "$EXE: Running $USUSPEND_PROG_PATH $ARGS..."
+       $USUSPEND_PROG_PATH $ARGS 2>&1 | vcat 2
+       ret=$?
+       case "$ret/$USUSPEND_RAM_UNSUREOK" in
+           0/*) :;;
+           32/1) :;; # unsure, but USuspendRamUnsureOk passed
+           *)
+               vecho 0 "$EXE: $USUSPEND_PROG_PATH failed (return code $ret)."
+               ;;
+       esac
     else
        vecho 1 "$EXE: Not actually suspending (--no-suspend given)."
     fi

-- 
 .''`.   martin f. krafft <[EMAIL PROTECTED]>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems

Attachment: signature.asc
Description: Digital signature (GPG/PGP)

Reply via email to