Bug 7530 - Problems w/ suspend and resume on Prostar 1200 Laptop
Summary: Problems w/ suspend and resume on Prostar 1200 Laptop
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: apmd
Version: 6.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-12-03 06:22 UTC by Donald Greer
Modified: 2008-05-01 15:37 UTC (History)
0 users

(edit)
Clone Of:
(edit)
Last Closed: 1999-12-08 15:00:48 UTC


Attachments (Terms of Use)

Description Donald Greer 1999-12-03 06:22:42 UTC
I used the apmd on my Prostar 1200 (Tiwanese OEM for certain Dell and
Gateway models) without difficulty.

Since upgrading to 6.1, I've noticed two problems:

1. On user-suspend, the first time I press the suspend key sequence, I get
a message "User suspend requested" or some such on the console but nothing
happens.  The second time I hit the key sequence the system suspends
normally.

2. When I suspend my system (I use hibernation mode ... yeah, yeah, I know
it isn't officially supported, but it works about 97% of the time) when the
system resumes, it no longer updates the system clock to sync with the HW
clock.  I get a message saying how long the system was suspended (as an
adjustment of minutes) but this the system doesn't correct the clock.

For 1, I simply must hit the suspend twice.  For 2, I need to figure out
how to get the "proxy" stuff in the man page working, and put in a "hwclock
--hctosys" command and that should fix it.

If you're curios, the limitations I've found to hibernation are:
- Don't leave your terminal in X windows (do an Alt-F1 before suspending).
- Don't leave any network apps running (servers in listen mode seem fine,
but Netscape or Applix will hose you about %40 of the time).

Comment 1 Donald Greer 1999-12-07 03:24:59 UTC
I've written an "apmd_proxy" script that resolves the problem with the date and
with the hibernation thing.  I stress tested it by loading bunches of X and
networking apps and suspending from the X console (usually doing hangs the
machine about 50% of the time on restart).
Here's the script:

#!/bin/bash
#
# apmd_proxy      This shell script takes care of starting and stopping
#                 various programs and services prior to suspending and
#                 resuming.
#

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

SUSPEND_DATA=/var/run/apmd.suspend.data

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        ps ax|egrep -v 'ps ax|egrep|perl' |perl -n -e '$_ =~ /^\s*(\d+).*/;print
"$1\n";'> $SUSPEND_DATA
        ;;
   stop)
        # Stop daemons.
        [ -e $SUSPEND_DATA ] && rm $SUSPEND_DATA
        ;;
suspend)
        # Suspend requested.
        #[ -e /tmp/suspend.log ] || touch /tmp/suspend.log
        #echo "Stating Suspend (`date`)" >>/tmp/suspend.log
        #ps ax > /tmp/presuspend
        for i in `ps ax|egrep -v 'ps ax|egrep|bash|perl|kill|cardmgr|apmd' |perl
-n -e '$_ =~ /^\s*(\d+).*/;print "$1\n";'`; do
         # echo -n `ps ax|grep $i`>> /tmp/suspend.log
         # grep $i $SUSPEND_DATA >/dev/null || echo 'STOPPED' >>
/tmp/suspend.log
         # grep $i $SUSPEND_DATA >/dev/null && echo 'RUNNING' >>
/tmp/suspend.log
          sync
          grep $i $SUSPEND_DATA >/dev/null || kill -STOP $i
        done
        #echo "System quiet... suspending (`date`)" >> /tmp/suspend.log
        #ps ax > /tmp/postsuspend
        sync
        ;;
 resume)
        # Resume requested.
        #[ -e /tmp/suspend.log ] || touch /tmp/suspend.log
        #echo "Stating Resume (`date`)" >>/tmp/suspend.log
        /sbin/hwclock --hctosys
        #echo "Time Corrected (`date`)" >> /tmp/suspend.log
        #ps ax > /tmp/preresume
        for i in `ps ax|egrep -v 'ps ax|egrep|bash|perl|kill|cardmgr|apmd' |perl
-n -e '$_ =~ /^\s*(\d+).*/;print "$1\n";'`; do
        #  echo -n `ps ax|grep $i`>> /tmp/suspend.log
        #  grep $i $SUSPEND_DATA >/dev/null || echo 'RESTARTING' >>
/tmp/suspend.log
        #  grep $i $SUSPEND_DATA >/dev/null && echo 'RUNNING' >>
/tmp/suspend.log
          sync
          grep $i $SUSPEND_DATA >/dev/null || kill -CONT $i
        done
        #echo "All processes restored (`date`)" >> /tmp/suspend.log
        #ps ax > /tmp/postresume
        ;;
standby)
        ;;
      *)
        echo "Usage: apmd {start|stop|suspend|resume|standby}"
        exit 1
esac

--------------------------
  You can remove the echos... they are simply the debugging info (and slow
things down a bunch).
  The idea is that when apmd is called, all the things that come before it are
"safe" and should not be touched (things like init).  You can also add things to
the egrep that should be ignored (like the bash shell that is running the script
:^).
  I'm sure it could be cleaned up a lot, but it's a quick hack that works and I
thought it would give y'all a starting place at a fix for hibernating machines
like mine.
  BTW, it also fixes the time problem with a call to hwclock.
  I'm not sending this to the apmd developers.  I figured y'all would clean it
up a bit and you would be donating the cleaned copy.
  Don

Comment 2 Bernhard Rosenkraenzer 1999-12-08 15:00:59 UTC
Have a look at the apmd package in rawhide - it solves the hibernation problem
and can work around some hardware problems (such as broken harddisks that need
hdparm settings after a suspend-to-disk).


Note You need to log in before you can comment on or make changes to this bug.