Bug 1415 - Lid switch can't wakeup machine from S3
Summary: Lid switch can't wakeup machine from S3
Alias: None
Product: ACPI
Classification: Unclassified
Component: Power-Sleep-Wake (show other bugs)
Hardware: i386 Linux
: P2 normal
Assignee: Shaohua
: 470 (view as bug list)
Depends on:
Reported: 2003-10-24 09:28 UTC by Shaohua
Modified: 2004-11-17 19:22 UTC (History)
16 users (show)

See Also:
Kernel Version: 2.6.0-test7
Regression: ---
Bisected commit-id:

patch for this error (13.80 KB, patch)
2003-10-24 09:32 UTC, Shaohua
Details | Diff
A more reasonable fix (15.79 KB, patch)
2003-10-28 00:20 UTC, Shaohua
Details | Diff
patch with typos fixed (15.32 KB, patch)
2003-12-17 13:13 UTC, Michal Schmidt
Details | Diff
Fixed version of patch (15.32 KB, patch)
2004-03-13 10:25 UTC, John Irwin
Details | Diff
patch 1: ACPI bus support for wakeup GPE (10.93 KB, patch)
2004-06-30 21:32 UTC, Shaohua
Details | Diff
patch 2: add user interface for wakeup GPE (8.49 KB, patch)
2004-06-30 21:34 UTC, Shaohua
Details | Diff

Description Shaohua 2003-10-24 09:28:19 UTC

echo "3" >/proc/acpi/sleep
then, press LID switch or sleep button can't wakeup the machine
Comment 1 Shaohua 2003-10-24 09:32:58 UTC
Created attachment 1171 [details]
patch for this error

this patch will create a proc entry called "/proc/acpi/wakeup_devices"
>cat /proc/acpi/wakeup_devices
will show all possible wake capable devices
>echo devicename > /proc/acpi/wakeup_devices
will enable the device to wakeup machine from sleeping state
call >echo devicename > /proc/acpi/wakeup_devices again will disable the
device's wakeup capablility.
Comment 2 Shaohua 2003-10-28 00:20:32 UTC
Created attachment 1231 [details]
A more reasonable fix
Comment 3 Ari Pollak 2003-11-14 07:48:48 UTC
I'm not sure if this is the same problem, but it seems that after waking up from
an S3 on my Thinkpad T41, nothing gets output anymore from /proc/acpi/event,
preventing acpid from catching any more signals.
Comment 4 Shaohua 2003-11-18 18:35:12 UTC
Yep, in my T40 I encounter same problem like you. ACPI interrupt losts after 
resuming from S3. But This track doesn't address this error. It just enables 
wakecapable devices.
Comment 5 Ari Pollak 2003-11-18 18:38:21 UTC
Should I open a separate bug for that issue?
Comment 6 Michal Schmidt 2003-12-17 13:13:54 UTC
Created attachment 1692 [details]
patch with typos fixed

I've tried Shaohua's patch from comment #2 (applied cleanly to
2.6.0-test11-bk12). It wouldn't compile. It had two typos and one missing
variable declaration. I'm attaching a fixed patch.
With this patch and 'echo "LID" > /proc/acpi/wakeup_devices' my IBM ThinkPad
R40 is able to wakeup.
(And I have the same problem as you. Is there a bug opened for it?)
Comment 7 Shaohua 2003-12-17 16:44:09 UTC
My patch is just a prototype, though it can work partly. Before it's merged, 
we must change much more. http://bugme.osdl.org/show_bug.cgi?id=1661 address 
power button interrupt lost after S3, but i'm not sure if it also address EC 
interrupt lost situation. But please try it.
Comment 8 Benoit Cosandey 2003-12-23 14:13:52 UTC
I tested this patch on a thinkpad t40p (2373 G1G), and you are right, it partly
Opening up the lid resume the machine, BUT interrupts are lost (in my case INT9
acpi,ath0). Letting /proc/acpi/wakeup_devices untouched (LID disabled), I can
resume the t40p with the power button (tried at least 3 times in a row).

Just in case, booting with or without pci=noacpi do not change this behavior.

tested kernel: 2.6.0 with acpi patch, with hwsleep.c and hwgpe.c patch, a
corrected DSDT and updated BIOS and EMBEDDED CONTROLLER

HTH to the quest of perfection
Comment 9 Adrian Bridgett 2004-01-15 15:49:00 UTC
this half works for me (2.6.1-mm2, thinkpad R40).  after echoing LID and SLPB to
/proc/acpi/wakeup_devices I can now resume the laptop (I suspended by closing
the lid and having an acpid script echoing 3 to /proc/acpi/sleep)

However the next time I close the lid, acpid is not spotting anything (nothing
in syslog).  The backlight does go out but I can see Xwindows still running. 
Interestingly, /proc/acpi/button/lid/LID/state is being correctly set to
open/closed as appropriate.

No other patches were applied to the kernel.
Comment 10 Ari Pollak 2004-01-15 15:54:45 UTC
Re: comment #9, that would probably be related to the ACPI interrupt bug above.
Comment 11 Adrian Bridgett 2004-01-15 16:43:02 UTC
Indeed! I should read more (the fact the comment near the hwsleep.c patch has
changed in 2.6.1 threw me a bit too).  Using both patches together everything
seems to work perfectly.  I wonder if it might be worth adding LID and SLPB to
the default enabled list - particularly since otherwise suspending means
removing battery to get the machine to reboot! Thanks.
Comment 12 Frank Seidel 2004-01-15 21:00:05 UTC
for my R40e (2684HTG) this patch seems not to solve this thing.
Applied it to an 2.6.1 kernel and tried it with and without
echoing LID and SLPB to wakeup_devices.... but this doesnt help
at all :-(

I still have to pull out the battery to even get it shutdown.
To me there seems to bo no reaction to my wakeup tries at all,
not even backlight or harddisk.

anything else i could try?
Comment 13 Rolf Offermanns 2004-01-31 19:06:24 UTC
This patch (typo fixed one) works for me.
IBM Thinkpad R40 2681CDG.
After applying I got the "no more acpi interrupts" problem, which in turn got
fixed by applying patch in bug #1661.
Thank you very much! :)
Comment 14 Martin Ley 2004-02-11 03:42:09 UTC
<a href="http://bugzilla.kernel.org/attachment.cgi?id=1692&action=view">This
patch</a>(Kernel 2.6.2) seems to work for my <a
Samsung P10 Notebook</a>. After enabling the power-button in
/proc/acpi/wakeup_devices the Notebook resumes, but the LCD backlight stays off
and all fans are running at full speed. I changed to the textconsole and pressed
Ctrl-Alt-Del to reboot, which worked then. So the machine did resume but no
I am using a custom DSDT for my notebook from acpi.sf.net. It's the only way to
get information about temperature and battery-status.
Comment 15 Tim Nordell 2004-02-13 16:51:54 UTC
I know this isn't directly related to this - and some think bug 1661's patch
fixes it, but my thinkpad t41 the interrupt for ACPI stops getting events after
wake up.  I tried applying this, and it works.  But, after the first wakeup from
this (ie, where the kernel WAS still getting ACPI events, and the power light is
on), it works fine.  The second time, when ACPI events are still not being
received, it goes to "sleep" but is waken up right away.  Just shows that
somewhere that isn't getting cleared, not sure.  Have not figured it out yet,
but looking around.
Comment 16 John Irwin 2004-03-13 10:25:09 UTC
Created attachment 2325 [details]
Fixed version of patch

Previous fixed version of patch still had one typo.  Refixed.
Comment 17 Jan Mynarik 2004-03-30 00:27:56 UTC
The patch doesn't help on IBM ThinkPad R40 (2681-BAG). Applied on 2.6.4 + acpi
patch 200403011 or acpi patch 20040326. Still unable to resume from S3, simply
no reaction (no disk spin etc).
Comment 18 Timo Warns 2004-03-30 00:39:59 UTC
Did you enable the wakeup devices?
The patch works well on my R40.
Comment 19 Jan Mynarik 2004-03-30 05:28:52 UTC
> Did you enable the wakeup devices?
> The patch works well on my R40.

If you mean echoing LIDB etc. to wake_up devices, then no. I was in hurry
(before leaving office to catch a train) when dowloading all possible patches to
fix my problem. I'll try it and send result here.

Anyway, what's the official status of this patch? Will it be merged to official
ACPI patch anytime soon? Or is it a hack and must be implemented in more
standard way?
Comment 20 Jan Mynarik 2004-03-30 08:11:57 UTC
>> Did you enable the wakeup devices?
>> The patch works well on my R40.

> If you mean echoing LIDB etc. to wake_up devices, then no.

Setting wake_up devices tried, works. Sorry for bothering and not reading all
comments at first.
Comment 21 Adrian Bridgett 2004-03-30 12:26:45 UTC
the "fixed versino of patch" (2325) is identical to 1692 except for one line
number - the actual code is unchanged - was this intended?
Comment 22 John Irwin 2004-04-02 16:16:48 UTC
> the "fixed versino of patch" (2325) is identical to 1692 except for one line
> number - the actual code is unchanged - was this intended?

Yep.  Just one character really.  But that change keeps the last line of the
patch from being left out.  The previously missing line is just the boot-time
printing though, so the old version of the patch still works (but gives a warning).

I also am surprised that this patch hasn't been integrated yet.  I guess the
intersection of ACPI, 2.6, and laptop users is pretty small.
Comment 23 Dominik Brodowski 2004-04-07 23:48:08 UTC
IMHO lid and power button GPEs should be enabled unconditionally, and there
should just be override capabilites in /proc/acpi/. Also, I'd say that this
needs to be fixed _very soon_, as it seems a severe flaw to me that no wake GPEs
are enabled when entering a sleep state.
Comment 24 Joerg Kliewer 2004-04-13 03:22:02 UTC
This patch works for me as well (Thinkpad R40, Kernel 2.6.4). However, after
waking up the system (i.e. by using the power button), my system does a reboot
instead of a resume. 
Comment 25 Timo Warns 2004-04-13 08:27:23 UTC
Joerg Kliewer wrote:
> This patch works for me as well (Thinkpad R40, Kernel 2.6.4). However, after
> waking up the system (i.e. by using the power button), my system does a reboot
> instead of a resume. 

As mentioned ealier, the patch works on my R40 (with 2.6.4).
Does acpid daemon run on your system? Did you check its configuration? Perhaps
it causes the reboot.
Comment 26 Dafydd Harries 2004-04-17 21:49:07 UTC
Suspend does not work for me on my R40e Thinkpad. I'm using kernel 2.6.5, with
the fixed patch applied. acpid is running, and the I've enabled wakeup devices
in /proc/acpi/wakeup_devices. Entering S3 and S4 via /proc/acpi/sleep will
suspend the machine, but it will not resume. It will not wake up until the
power and battery have been removed.
Comment 27 Achim Steinmetz 2004-04-20 11:28:17 UTC
I use linux-2.6.4 with the patch included in this bug report here on a SAMSUNG 
X10 laptop and still do not get the machine waking up from ACPI S3 mode.

# cat /proc/acpi/wakeup_devices
Device  Speep state     Status
LID0       3            disabled
PWRB       4            disabled
LANC       4            disabled
MODM       4            disabled
# echo LID0 >/proc/acpi/wakeup_devices
# cat /proc/acpi/wakeup_devices
Device  Speep state     Status
LID0       3             enabled
PWRB       4            disabled
LANC       4            disabled
MODM       4            disabled

Via acpid (using /etc/acpi/lid.sh) I echo the value 3 into /proc/acpi/sleep and 
the system enters suspend-to-ram mode fine, the LED starts blinking green. So 
all looks fine, but no matter what I can not wake it up anymore and have to cold 
reset the unit (AC offline, unplug battery).

Here the messages I see from acpid just before the suspend and then you see the 
restart after bootup as resume doesn't work.

[Tue Apr 20 20:06:06 2004] received event "button/lid LID0 00000080 00000003"
[Tue Apr 20 20:06:06 2004] executing action "/etc/acpi/lid.sh"
[Tue Apr 20 20:06:06 2004] BEGIN HANDLER MESSAGES
[Tue Apr 20 20:08:03 2004] starting up
[Tue Apr 20 20:08:03 2004] 2 rules loaded

My system is running linux-2.6.4 using acpi-20040311 patch and the wakeup patch 
from this site.
Comment 28 David Leemans 2004-05-11 19:35:44 UTC
I use linux-2.6.6  and acpi version 20040326 with the wakeup_devices patch on a
Toshiba Satellite Pro 6000.
The machine enters suspend mode fine, when my acpi_handler.sh issues a 
echo -n "mem" > /sys/power/state on a Lid close event.

It does not resume however when I open the lid again, but resumes fine again
when I press the powerbutton once. Apparently, acpid does not even notice the
Lid open event : my handler script does not log anything at all (as it is
supposed to do), neither does acpid.

cat /proc/acpi/wakeup_devices
Device	Speep state	Status
 COM	   3		disabled
USB1	   3		disabled
ASND	   3		disabled
VIY0	   3		disabled
VIY1	   3		disabled
 LAN	   4		disabled
MPC0	   3		disabled
MPC1	   3		disabled
 LID	   4		 enabled

I find it odd that the powerbutton is not even listed, certainly if it's the
only button that wakes up the laptop ;)
I can live with it, but it would nice if my laptop would resume by simply
opening the lid again (as it did when I used APM).
Comment 29 Andreas Kotowicz 2004-05-31 11:03:58 UTC
this patch actually works fine here on my thinkpad R40 with kernel 2.6.6.
unfortunately my network device dies about a minute after the resume. sound works.  
Comment 30 Andreas Kotowicz 2004-06-01 01:42:15 UTC
kernel 2.6.7-rc2 fixes the network device freeze for me. 
patch number 2325 applies cleanly against 2.6.7-rc2 and I just get this message
during kernel compilation:

  CC      drivers/acpi/sleep/wakeup.o
drivers/acpi/sleep/wakeup.c:144: warning: function declaration isn't a prototype

but except this error message and the fact that I have to take the network
device down before supend everything is working
Comment 31 Shaohua 2004-06-10 02:14:15 UTC
If you laptop can't receive ACPI interrupt after s3, please refer to Bug 2643. 
And please report your test result in Bug 2643. Thanks.
Comment 32 Christian Hesse 2004-06-21 13:57:39 UTC
Same results on Samsung X10 as Achim Steinmetz reported. Any news to the 
problem? Anything I can test? 
Comment 33 Len Brown 2004-06-28 21:55:28 UTC
*** Bug 470 has been marked as a duplicate of this bug. ***
Comment 34 Shaohua 2004-06-30 21:32:53 UTC
Created attachment 3294 [details]
patch 1: ACPI bus support for wakeup GPE

This patch is against leatest ACPI test tree.
Comment 35 Shaohua 2004-06-30 21:34:50 UTC
Created attachment 3295 [details]
patch 2: add user interface for wakeup GPE
Comment 36 Euan MacGregor 2004-08-17 11:34:13 UTC
Just another data point:
Applied the 20040715 ACPI patch (which appears to contain some version of the
patches attached) to and my Compaq&#12288;Evo N600c now powers up when
pressing the sleep button after suspending to RAM (previously would switch off).  

(Unfortunately, after powerring on it fails to resume like in bug 2664)
Comment 37 Len Brown 2004-11-17 19:22:28 UTC
*** Bug 3297 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.