[ltp] T23: suspend resumes immediately: moon light stays blinking

Simon Williams linux-thinkpad@linux-thinkpad.org
Mon, 27 Aug 2007 23:00:52 +0100


Damien Challet wrote:
> On Wednesday 22 August 2007 14:31:38 Marius Gedminas wrote:
>> On Wed, Aug 22, 2007 at 08:23:13AM -0400, Mark Stosberg wrote:
>>> Here's my suspend problem on my T23: Invoking suspend appears to little.
>>> I can see the network disconnect, but then immediately reconnect. The
>>> logs s how an immediate resume. The "moon" indicator light starts
>>> blinking, and never stops.
> 
> Suspend to ram and to disk works with my T23. The only problem is that USB is 
> dead when resuming, a known problem of Feisty which I think is solved by 
> using the suspend2 kernel.
> 
> Try to install the hibernate package and hibernate in a shell in order to have 
> more details about what is happening.

That won't help you. The hibernate is for "software suspend"- that is, 
hibernation controlled entirely by the OS, with no bios interaction 
beyond "turn off now".

I think XP hibernates in a similar way, but on win98 hibernation was 
exactly the same as suspend to ram, except that once all the data was 
saved to the RAM the BIOS would then copy it to the hibernation 
partition on the HDD so that the power could be turned off completely.

Hibernation = Power off completely. Suspend to RAM (or sleep) = power 
off for everything except RAM.

I only tried very briefly to get hibernation working on my T23 and then 
couldn't be bothered. I always suspend (much faster).

If the moon light keeps flashing (you should have some sort of error 
beep as well) then something is preventing a suspend. Usually this is 
hardware, but can be the kernel. Possible causes of suspend failing are:
- USB devices
- PCMCIA/Cardbus devices
- Internal wireless if you have it
- Badly configured X server or graphics driver
- Possibly the ultrabay device (but unlikely)
- A badly configured kernel (usually ACPI related)
- Some run time kernel or hardware setting

Until about kernel 2.6.20 (something like that) suspend would not work 
for me if I had a framebuffer console (vesafb). savagefb has never worked.
I can't think of any USB devices I have had a problem with, other than a 
bluetooth dongle (though I don't think it likes USB storage devices 
much- and if you remove them while it's suspended that's a guaranteed 
sync error on the device and a system freeze).
PCMCIA/cardbus devices are usually a pain. I have not come across a 
wireless PCMCIA card that I can suspend without removing. The internal 
miniPCI one shouldn't be a problem, but make sure it isn't connected to 
anything.
I have a script which always changes the current virtual terminal to a 
console device instead of X- this often helps.
My script (called by acpid) is included at the end of this email. I've 
pasted all of it for completeness, but a lot of it is pretty specific to 
my setup (the acpi_log commands were for me trying to get my bluetooth 
PCMCIA card to work with a suspend).

Hope this helps.
Simon

/usr/local/sbin/acpi-sleep.sh:
#!/bin/sh

function acpi_log() {
         echo `date` >> /var/log/acpi-sleep.log
         echo $1 >> /var/log/acpi-sleep.log
}

wireless_restart=0

# discover video card's ID
ID=`lspci | grep VGA | awk '{ print $1 }' | sed -e 's@0000:@@' -e 's@:@/@'`

# securely create a temporary file
TMP_FILE=`mktemp /var/tmp/video_state.XXXXXX`
trap 'rm -f $TMP_FILE' 0 1 15

# switch to virtual terminal 1 to avoid graphics
# corruption in X
chvt 1

# write all unwritten data (just in case)
sync

if [ "`ifconfig | grep ath0`" != "" ]; then
         wireless_restart=1
fi

/etc/rc.d/wireless stop

# dump current data from the video card to the
# temporary file
cat /proc/bus/pci/$ID > $TMP_FILE

# Shut down bluetooth devices
hciconfig hci0 down
hciconfig hci1 down

# I hope you weren't using these devices...
umount /mnt/pcmcia
umount /mnt/mmc
if [ "`mount | grep hde`" != "" ]; then
         logger -t acpi-sleep "Fatal: hde is still mounted."
         exit 1
fi
ifconfig eth1 down
#pccardctl eject

# suspend
echo -n mem > /sys/power/state

acpi_log resuming...

# restore video card data from the temporary file
# on resume
cat $TMP_FILE > /proc/bus/pci/$ID

acpi_log "video data restored"

# switch back to virtual terminal 7 (running X)
chvt 7

acpi_log "switched vt"

if [ "$wireless_restart" == "1" ]; then
         /etc/rc.d/wireless restart 2>/dev/null > /dev/null &
fi

acpi_log fixsound

{ sleep 2 ; fixsound ; } &

acpi_log pre_insert

pccardctl insert &

acpi_log post_insert

{ pccardctl eject 0; pccardctl insert 0; }

# remove temporary file
rm -f $TMP_FILE

acpi_log post_tmpfile