Suspending disbelief

Henk Hesselink linux-thinkpad@www.bm-soft.com
Thu, 29 Apr 1999 20:49:06 +0000


Okay, I've now had a bit of time to play with powermgmt./PCMCIA/etc. on my 770X
running mostly stock Redhat 5.2/2.0.36 kernel.  This is what I've discovered.
(Note that I use DHCP, which probably adds extra problems)

First off, thanks for all the tips and advice.

The rules seem to be (and I've not seen anything in the DOS PS2 utility that
could change this):

  - when in X, the AC adapter must be unplugged before suspending else you'll
get the psychelic display and your machine may hang
  - when not in X, suspending while the AC adapter is plugged in seems
(usually?) to work
  - if a PCMCIA network card is left in, suspending will work but the card will
not work after the resume
  - pressing Fn-F4 and closing the lid/pushing the little tab are equivalent

I've run across some strange effects, not completely reproducible, that suggest
Linux/X and the BIOS can get out-of-sync.  For example after getting the
psychelic display do a ctl-alt-backspace to get out of X (this sometimes
doesn't work as the whole machine hangs and needs a hard reboot), then do a
"shutdown -h now" (power-off on halt must be enabled).  This sometimes doesn't
power down but instead suspends: closing and opening the lid does a resume.
I've seen other weirdness which I can't recall right now.

What I've done is:

  - I upgraded the PCMCIA package from 3.0.6 to 3.0.9, which solved my double
eject/insert cycle problem
  - I upgraded the apmd package from 2.4 to 3 plus I changed it a bit to call
online/offline hooks whenever going to/from AC
  - apmd now calls "cardctl eject" on suspend and "cardctl insert" on resume

As long as I remember to unplug the AC adapter this now works perfectly.  In
fact I can now close the lid at home/office where I run DHCP and open it at a
client's office (most also run DHCP) and be up and running with a new
IP address, default router, DNS server, etc. without any action needed on my
part.  Very impressive!

Hibernate (Fn-F12) also works (this currently uses the windoze hibernate file,
something I read seems to suggest you can make this a separate, small
partition).  This shuts down in about 10 secs and comes up in about the same
time.  Battery drain is a couple of percent per day.  Come next May and I may
well have a laptop with an uptime of a year :-)

One thing I've not got working (and why I added the online/offline hooks) is to
make apmd beep and wait a while if suspending with the AC adapter plugged, to
give me a chance to unplug it before the actual suspend occurs (which is after
the suspend hooks are executed by apmd).  I still get the psychelic display
however.  It seems that whatever is causing the problem happens before the BIOS
notifies apmd.

Happy laptopping,

Henk Hesselink
Anda Consulting