Getting Advanced Power Management Working under RedHat 6.2 on a Dell Inspiron 7500
Dave Aiello wrote, "Tonight, I finally configured Advanced Power Management (APM) on my Dell Inspiron 7500 running RedHat Linux 6.2 to permit the system to suspend and restore itself without hanging or crashing. The process of doing this was one of those cryptic experiences that people often hear about in connection with Linux system configuration. Read on for the whole story...."
Dave Aiello continued:
Successfully suspending and restoring my laptop was one of the operations that I was certain could be done somehow. The question in my mind was, how many times would I have to restart the machine without properly shutting it down?
For the record, the configuration is a Dell Inspiron 7500 with a 650mHz Pentium III, VA Linux 6.23 (derived from RedHat 6.2), 512M RAM, 20G hard disk.
Prior to this effort, any attempt to suspend the laptop resulted in a lockup condition with the display remaining on and the system apparently unresponsive.
The first breakthrough was finding the page called Linux on a Dell Inspiron 7500 Laptop on Coralys.com. The Advanced Power Management section of that page provided some information that I had not seen elsewhere:
If you want to put your laptop in suspend mode by closing the lid without having to shutdown Linux you have to follow these steps:
- Press <Ctrl><Alt><F1> to switch to the text console, once there...
- Close the lid of your laptop, the screen will go blank and you will here {sic} it powering down.
The next passage helps to explain the number of consoles in RedHat. This is critically important because the instructions on the Coralys Web Page turns out to be correct for Red Hat 6.0, not 6.2:
To resume your Linux fun perform the reverse operation:
- Open the lid and put the LCD screen in the viewing position
- Now you are looking at the text console, to switch back to your X session press {<Ctrl><Alt><F7>, not printed on the page for some reason}. At least Red Hat comes with 'only' 6 text consoles configured, and X always uses the first non-used {sic} console, this being console 7 on Red Hat.
- Woa! there is your X session, just as you left it when you went into suspend mode!
The process described thus far on this Web Page actually worked. This was the first time that I had ever successfully suspended and resumed this laptop.
The page goes on to discuss the modifications to the default Red Hat configuration that is necessary to install a post resume action. Trying to follow the instructions given at this stage made me realize that they were for a different version of Red Hat than I had running on the laptop I was using.
The Coralys page talks about the file called /etc/sysconfig/apmd. This file exists in Red Hat 6.2, but its structure is different from the same file in Red Hat 6.0. The only change I had to make to get suspend and restore to work properly was to uncomment the following line in the script:
CHANGEVT="7"
This explicitly tells the script called /etc/sysconfig/apm-scripts/apmscript to execute the command chvt 1 to switch to the first virtual terminal during the suspend operation, and to execute the command chvt "$CHANGEVT" upon resume. This automates the process that is discussed on the Coralys page.
The only remaining issue is keyboard repeat rates. This is solved in the Red Hat 6.2 configuration by adding a file called /etc/sysconfig/apm-scripts/apmcontinue that contains the following text:
#!/bin/bash
# THIS IS APMCONTINUE, BY DAVE AIELLO, 03/26/2001; you
# can put your stuff into apmcontinue for every link you create to apmscript;
# for a start and definitely enough for most laptops we have two links and
# according subroutines defined here: suspend and resume; all other links
# will be redirected directly to apmcontinue which you can create; also
# suspend and resume call apmscript, so you can also do other things (like
# reinitialising some PCMCIA-Card) there; apmcontinue will get the name
# as which it was called as $1; for debugging see the logfiles
#
# This script can be controlled by editing /etc/sysconfig/apmd.PROG=`basename "$0"`
case "$PROG" in
suspend)
# # Don't do anything by default
;;
resume)
# Restore the keyboard rate. This fix was suggested
# on Coralsys' Linux on Dell Inspiron 7500 Page
# under "Advanced Power Management":
#
# http://www.coralsys.com/linux/dell7500.shtml
#
# -- Dave Aiello, 03/26/2001
#
/usr/bin/kbdrate -r 30 -d 250
;;
esac
This solved the only other known issue with suspend and restore.
So, now it is possible for me to use this laptop as I would a PC running Windows. When I need to move it from one place to another, I now have the option of suspending it instead of shutting it down. This is likely to be a huge personal productivity improvement.
I will need to look at the implications of suspending the laptop when VMware Workstation is running. It is not clear at all that the child operating system will survive the roundtrip as well as the parent Linux operating systems apparently has.
Further information about this issue will be posted to ctdata.com as we uncover it.