Skip to contentSkip to conversation

bug in acpid scripts

DISCUSSION Russell Neches 6 participants 7 messages Jul 23, 2004 – Aug 11, 2004 4 messages not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

I've assumed that the S3 sleep state was broken on my laptop for some time now, but it turns out that the problem was cased by the behavior of the distributed powerbtn.sh script. Or, at least, that's where the bug manifests itself.

My system always enters S3 without complaining, and resumes without complaining. Then it immediately begins a clean shutdown. I had assumed this was caused by general S3 breakage, but the problem is actually caused by acpid catching the power button event that triggered the system to resume. It then dutifully calls powerbtn.sh, and the system shuts down.

Tossing an "exit" at the beginning of powerbtn.sh fixes the problem (with an obvious trade-ff), and my laptop suspends and resumes perfectly. Well, almost perfectly -- I have to unload ohci_hcd before shutting down, and I have to figure out how to get wireless working after resume, but those are separate issues.

Is there a sensible way to tell if the system is coming off of S3? I imagine I could do something like this to get into S3;

	#!/bin/sh
	touch /tmp/S3.ignore.powerbtn
	echo 3 > /proc/acpi/sleep
	sleep 10
	rm /tmp/S3.ignore.powerbtn

and then add this to the beginning of powerbtn.sh;

if [ -e /tmp/S3.ignore.powerbtn ]; then
exit
fi

but that just seems dumb. Any better ideas?

Russell

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click

#2 lore raw
In reply to a message not in the archive
Quoted 8 lines · Russell Neches

Tossing an "exit" at the beginning of powerbtn.sh fixes the problem (with an obvious trade-ff), and my laptop suspends and resumes perfectly. Well, almost perfectly -- I have to unload ohci_hcd before shutting down, and I have to figure out how to get wireless working after resume, but those are separate issues.

Is there a sensible way to tell if the system is coming off of S3? I imagine I could do something like this to get into S3;

Adding new wakeup devices helps in this area a lot. Check out the latest acpi patch to the kernel -- I had this same issue and applied the acpi-20040715 patch, which among other things adds support for other things waking up the machine (sleep button, lid, etc.)

This simply makes it so you don't have to press the power button to wake up from S3. While that is not exactly a direct solution, it was the one I was looking for anyway.

--Vernon

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click

#4 lore raw
In reply to a message not in the archive
Quoted 8 lines

Adding new wakeup devices helps in this area a lot. Check out the latest acpi patch to the kernel -- I had this same issue and applied the acpi-20040715 patch, which among other things adds support for other things waking up the machine (sleep button, lid, etc.)

This simply makes it so you don't have to press the power button to wake up from S3. While that is not exactly a direct solution, it was the one I was looking for anyway.

Interesting, though I think the only thing my laptop would be able to use to trigger S3 would be the lid switch, and I don't think I'd want that. I think one of the best things about Apple's laptops is how awesome their sleep support is. The worst thing about them (in my opinion) that they make it a nightmare to disable the sleep-on-lid-close feature.

Obviously, some people will love it, so I'm very pleased that we can configure S3/wakup triggers that way. But, considering tha S3 still breaks things...

Oi.

Russell

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click

#5 lore raw
In reply to a message not in the archive
Quoted 6 lines · Russell Neches

My system always enters S3 without complaining, and resumes without complaining. Then it immediately begins a clean shutdown. I had assumed this was caused by general S3 breakage, but the problem is actually caused by acpid catching the power button event that triggered the system to resume. It then dutifully calls powerbtn.sh, and the system shuts down.

My current workaround is to make button support modular, and then remove the button module during suspend. The power button event then gets ignored on wakeup.

Signature · 9 lines
Matthew Garrett | [email protected]



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
#7 lore raw
In reply to a message not in the archive
Quoted 9 lines · Matthew Garrett
Quoted 6 lines · Russell Neches

My system always enters S3 without complaining, and resumes without complaining. Then it immediately begins a clean shutdown. I had assumed this was caused by general S3 breakage, but the problem is actually caused by acpid catching the power button event that triggered the system to resume. It then dutifully calls powerbtn.sh, and the system shuts down.

Quoted 3 lines

My current workaround is to make button support modular, and then remove the button module during suspend. The power button event then gets ignored on wakeup.

You may simply want to stop acpid just before suspending and restarting it after having resumed.

Signature · 9 lines
mattia
:wq!


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
#9 lore raw
In reply to a message not in the archive

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

Quoted 6 lines · Mattia Dongili
Quoted 3 lines · Matthew Garrett

My current workaround is to make button support modular, and then remove the button module during suspend. The power button event then gets ignored on wakeup.

You may simply want to stop acpid just before suspending and restarting it after having resumed.

or you can use an hack similar to my script attached (original one at
http://sourceforge.net/mailarchive/forum.php?thread_id=3676335&forum_id=6102
as this problem was already reported in this list).

Thx, bye,
Gismo / Luca

=====

luca@gismo:~/download$ cat /etc/acpi/tbtn_power.sh
#!/bin/sh
#
# /etc/acpi/btn-power.sh
# BASH script which acts when the 'power button' is pressed, causing
#   - shutdown
#
# Useful infos at
#   - http://acpi.sourceforge.net/documentation/sleep.html
#
# (C) 2004 - Gismo / Luca Capello <luca.pca.it> http://luca.pca.it
# shutdown
echo "Checking if resuming from S1..."
if tail -n 5 /var/log/messages | grep 'Restarting tasks... done'
then
        echo "Resuming from S1, so not acting, exited."
        exit 0
else
        echo "Shutdown in progress"
fi

if ps -Af | grep -q '[k]desktop' && test -f /usr/bin/dcop then

    dcop --all-users ksmserver ksmserver logout 0 2 0 && exit 0

fi
/sbin/init 0
luca@gismo:~/download$
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org

iD8DBQFBAnTEVAp7Xm10JmkRAjGWAJ9nFHsoIIDg298SXBF4VIDQ6QoK3ACeOBy2 UdlexHHxH2oiVYAOQjtBRM0=
=gB7h
-----END PGP SIGNATURE-----

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click

#10 lore raw
In reply to a message not in the archive

Hi!

Quoted 8 lines

Tossing an "exit" at the beginning of powerbtn.sh fixes the problem (with an obvious trade-ff), and my laptop suspends and resumes perfectly. Well, almost perfectly -- I have to unload ohci_hcd before shutting down, and I have to figure out how to get wireless working after resume, but those are separate issues.

Is there a sensible way to tell if the system is coming off of S3? I imagine I could do something like this to get into S3;

I guess that kernel should not send that event to userspace... Fix the kernel.

Pavel

Signature · 9 lines
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms         



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285