Bug#336635: patch: use any available suspend mechanism

2006-06-04 Thread Bernard Blackham
On Fri, Jan 06, 2006 at 09:23:28PM -0800, Jamey Sharp wrote:
 I would like the hibernate script to work out-of-the-box on whatever
 suspend mechanism is available, preferring Suspend2 but falling back to
 sysfs or acpi if necessary. I've attached a patch against hibernate
 1.12-1 to do this.

Thanks for that Jamey. I've incorporated a slightly different
approach into the next hibernate release, which modularises the
configuration files too.  The structure is now:
 hibernate.conf contains
   TryMethod suspend2.conf
   TryMethod disk.conf
   TryMethod ram.conf

 Each of {suspend2,disk,ram}.conf contain a call to their method,
 and anything else specific to that mode of suspend. They all also
 include common.conf, which has the bulk of the configuration
 options (commented out).

I hope this still does what you want it to!

Bernard.

-- 
 Bernard Blackham bernard at blackham dot com dot au


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#336635: patch: use any available suspend mechanism

2006-01-07 Thread martin f krafft
also sprach Jamey Sharp [EMAIL PROTECTED] [2006.01.07.0623 +0100]:
 I would like the hibernate script to work out-of-the-box on whatever
 suspend mechanism is available, preferring Suspend2 but falling back to
 sysfs or acpi if necessary. I've attached a patch against hibernate
 1.12-1 to do this.

Brilliant idea. I vote for the patch, but I cannot test it right
now.

Thanks a lot!

-- 
 .''`. martin f. krafft [EMAIL PROTECTED]
: :'  :proud Debian developer and author: http://debiansystem.info
`. `'`
  `-  Debian - when you have better things to do than fixing a system
 
Invalid/expired PGP (sub)keys? Use subkeys.pgp.net as keyserver!
 
$complex-{'data'}[$structures][$in_perl] = @{$can{'be'}-[$painful]};


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


Bug#336635: patch: use any available suspend mechanism

2006-01-06 Thread Jamey Sharp
Package: hibernate
Version: 1.12-1
Followup-For: Bug #336635

I would like the hibernate script to work out-of-the-box on whatever
suspend mechanism is available, preferring Suspend2 but falling back to
sysfs or acpi if necessary. I've attached a patch against hibernate
1.12-1 to do this.

The code to handle the case where more than one method is available is
untested, because I have only the sysfs method available; but I've
tested that after this patch the default hibernate.conf tries suspend2
and acpi but uses sysfs.

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

hibernate depends on no packages.

Versions of packages hibernate recommends:
ii  console-tools  1:0.2.3dbs-60 Linux console and font utilities
ii  hdparm 6.3-3 tune hard disk parameters for high
pn  vlock  none(no description available)

-- no debconf information
diff -ur hibernate-1.12/hibernate.conf hibernate-1.12-tryall/hibernate.conf
--- hibernate-1.12/hibernate.conf   2006-01-06 17:59:39.0 -0800
+++ hibernate-1.12-tryall/hibernate.conf2006-01-06 18:03:27.0 
-0800
@@ -44,8 +44,8 @@
 ## To use /sys/power/state to suspend your machine (which may offer
 ## suspend-to-RAM, suspend-to-disk, standby, etc) comment out all the options
 ## above for Software Suspend 2, below for acpi_sleep, and uncomment this line.
-## You may replace mem with any one of the states from cat /sys/power/state
-# UseSysfsPowerState mem
+## You may replace disk with any one of the states from cat /sys/power/state
+UseSysfsPowerState disk
 # PowerdownMethod shutdown
 
 ### acpi_sleep
@@ -53,7 +53,7 @@
 ## all the options above for Software Suspend 2 and sysfs, and uncomment this
 ## line. The number refers to the ACPI sleep state - 3 is suspend-to-RAM and
 ## 4 is suspend-to-disk.
-# UseACPISleep 4
+UseACPISleep 4
 
 ##
 ### Some global settings
Only in hibernate-1.12: hibernate.spec
Only in hibernate-1.12: init.d
Only in hibernate-1.12: install.sh
diff -ur hibernate-1.12/scriptlets.d/acpi_sleep 
hibernate-1.12-tryall/scriptlets.d/acpi_sleep
--- hibernate-1.12/scriptlets.d/acpi_sleep  2005-10-01 22:54:28.0 
-0700
+++ hibernate-1.12-tryall/scriptlets.d/acpi_sleep   2006-01-06 
19:35:26.0 -0800
@@ -15,8 +15,9 @@
 ACPISleepConfigEnabler() {
 [ $1 != useacpisleep ]  return 1
 [ -n $USING_ACPI_SLEEP ]  return 0
+[ -n $HIBERNATE_SUSPEND_METHOD ]  return 0
+EnsureACPISleepCapable || return 0
 UsingSuspendMethod acpi_sleep
-AddSuspendHook 10 EnsureACPISleepCapable
 AddSuspendHook 99 DoACPISleep
 USING_ACPI_SLEEP=$2
 return 0
Only in hibernate-1.12/scriptlets.d: modules_gentoo
diff -ur hibernate-1.12/scriptlets.d/suspend2 
hibernate-1.12-tryall/scriptlets.d/suspend2
--- hibernate-1.12/scriptlets.d/suspend22005-10-01 22:54:28.0 
-0700
+++ hibernate-1.12-tryall/scriptlets.d/suspend2 2006-01-06 19:35:26.0 
-0800
@@ -66,9 +66,10 @@
 [ $1 != usesuspend2 ]  [ $1 != useswsusp2 ]  return 1
 BoolIsOn $1 $2 || return 0
 [ -n $USING_SWSUSP2 ]  return 0
-UsingSuspendMethod suspend2
 AddConfigHandler Swsusp2ConfigOptions
-AddSuspendHook 10 EnsureSwsusp2Capable
+[ -n $HIBERNATE_SUSPEND_METHOD ]  return 0
+EnsureSwsusp2Capable || return 0
+UsingSuspendMethod suspend2
 AddSuspendHook 97 ChangeToSwsuspVT
 AddSuspendHook 99 DoSwsusp2
 AddResumeHook 97 ChangeFromSwsuspVT
@@ -162,6 +163,7 @@
vecho 0 $EXE: Filewriter size is not numeric!
exit 1
fi
+   [ -z $USING_SWSUSP2 ]  return 0
AddSuspendHook 06 Swsusp2SetupFilewriter
AddResumeHook 06 Swsusp2CleanupFilewriter
;;
@@ -170,11 +172,13 @@
SWSUSP_FILEWRITER_NOVERIFY=1
;;
loadsuspendmodules)
+   [ -z $USING_SWSUSP2 ]  return 0
AddSuspendHook 05 Swsusp2LoadModules
shift
SWSUSP_LOAD_MODULES=$@
;;
unloadsuspendmodulesafterresume)
+   [ -z $USING_SWSUSP2 ]  return 0
BoolIsOn $1 $2 || return 0
AddResumeHook 05 Swsusp2UnloadModules
;;
@@ -196,6 +200,7 @@
SWSUSP_ENCRYPTOR=$2
;;
procsetting)
+   [ -z $USING_SWSUSP2 ]  return 0
if [ -z $OPT_DRY_RUN ] ; then
if [ -z $SWSUSP_EXTRA_PROC_SETTINGS ] ; then
SWSUSP_EXTRA_PROC_SETTINGS=`mktemp 
/tmp/tmp.hibernate.XX`
@@ -215,6 +220,7 @@
*)
return 1
 esac
+[ -z $USING_SWSUSP2 ]  return 0
 if [ -z $SWSUSP2_HOOKED ] ; then