[ltp] Re: Suspend, hibernate and the 600E
Marc Wilson
linux-thinkpad@linux-thinkpad.org
Fri, 5 Dec 2003 19:44:43 -0800
On Fri, Dec 05, 2003 at 12:01:01PM +0100, linux-thinkpad-request@linux-thinkpad.org wrote:
> Message: 8
> To: linux-thinkpad@linux-thinkpad.org
> From: "Tony Sequeira" <tony@sequeira.com>
> Date: Thu, 04 Dec 2003 14:16:09 +0000 (GMT)
> Subject: [ltp] Suspend, hibernate and the 600E
> Reply-To: linux-thinkpad@linux-thinkpad.org
> Attempting to get suspend working on a TP 600E, LFS kernel 2.4.23.
Heh... my experience was that it was hard to get it NOT to suspend. I've
been trying to use the 600E for wireless snooping and there are all sorts
of ways the BIOS can put the machine to sleep while you're not looking.
You have to pretty much lobotimize it with tpctl. ^_^
> Have compiled and instaklled apmd. However suspend (apm -s) does not
> work for the 'ordinary' user, only root.
Correct. I wouldn't make the apm binary suid root, either... I'd use sudo
first. Making it suid root would mean that anyone who could run the binary
could suspend the machine, which might not matter for a laptop, but is
otherwise bad practice.
> I'm concerned however that neither addresses the 'suspend on lid close'
> ability.
Well, apmd neither knows nor cares about the lid switch. That's monitored
by the BIOS, and tpctl gives you access to it. There's also ntpctl which
is the ncurses interface to tpctl.
On the 600E, you're looking for the "PM sedate lid closure" option (in
ntpctl) or the "--pm-sedation-lid-closure" option in tpctl. You want:
thinkpad $ tpctl --pm-sedation-lid-closure
power management sedative events: capability current
(SZRHO) (SZRHO)
lid-closure-initiated: -Z--- -Z---
The option you want is "Z", which conveniently enough is also the only one
the 600E supports.
On mine (Debian unstable), as soon as I close the lid, apmd gets an event,
and he goes to sleep. Open the top, and he wakes up, and apmd gets another
event. Until I figure out what's actually going on, I have apmd 'cardctl
eject' my Cisco 350, and 'cardctl insert' it when I unsuspend it. If I
leave it enabled across the suspend, it doesn't survive, although my Prism2
D-Link 650 does.
Debian has an initscript (part of the tpctl package) that handles the lid
switch. The supplied configuration file in /etc/default/tpctl looks like:
thinkpad $ cat /etc/default/tpctl
# Set PSL to the letter indicating what normally should be done when the
# ThinkPad's lid is closed. The tpctl initscript will put the machine
# into this mode after bootup. During shutdown and bootup, lid-closure-
# induced sedation will be disabled. The letters to use are:
# S:tandby, Z:uspend, R:edisafe, H:ibernate, O:ff, -: do nothing.
# Leave PSL unset to prevent the tpctl initscript from managing this feature.
PSL="Z"
The initscript itself looks like:
thinkpad $ cat /etc/init.d/tpctl
#!/bin/sh
#
# ThinkPad Configuration Tools for Linux initscript
#
# This script is part of the tpctl package
#
# Aug 2003: Written by Thomas Hood
PATH=/bin:/sbin:/usr/bin:/usr/sbin
TPCTL=/usr/bin/tpctl
unset PSL
[ -f /etc/default/tpctl ] && . /etc/default/tpctl
test -x $TPCTL || exit 0
start()
{
[ "$PSL" ] && tpctl --quiet --psl="$PSL" > /dev/null
}
stop()
{
[ "$PSL" ] && tpctl --quiet --psl=- > /dev/null
}
case "$1" in
start)
echo -n "Starting tpctl... "
start
echo "done."
exit 0
;;
stop)
echo -n "Stopping tpctl... "
stop
echo "done."
exit 0
;;
restart|force-reload)
echo -n "Restarting tpctl... "
stop
start
echo "done."
exit 0
;;
*)
echo "Usage: /etc/init.d/apmiser {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
Hope this all helps!
--
Marc Wilson | QOTD: "He's on the same bus, but he's sure as hell
msw@cox.net | got a different ticket."