public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* RE: bug in acpid scripts
@ 2004-08-13  0:52 Li, Shaohua
       [not found] ` <B44D37711ED29844BEA67908EAF36F038ADB3E-4yWAQGcml65pB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Li, Shaohua @ 2004-08-13  0:52 UTC (permalink / raw)
  To: Nathan Bryant
  Cc: russell-1vnkWVZi4QaVc3sceRu5cw,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]

Hi,
Oops, I'm sorry the patch has typo. I changed the parameter name after
my test, but I forgot changing all. Could you please try this one? Sorry
for the inconvenience.

Thanks,
Shaohua

>-----Original Message-----
>From: Nathan Bryant [mailto:nbryant-p32f3XyCuykqcZcGjlUOXw@public.gmane.org]
>Sent: Friday, August 13, 2004 8:25 AM
>To: Li, Shaohua
>Cc: russell-1vnkWVZi4QaVc3sceRu5cw@public.gmane.org; acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>Subject: Re: [ACPI] bug in acpid scripts
>
>Li, Shaohua wrote:
>
>>Russell Neches Sunday, July 25, 2004 9:42 AM wrote:
>>
>>
>>>To: Li, Shaohua
>>>Cc: ACPI-Devel
>>>Subject: RE: [ACPI] bug in acpid scripts
>>>
>>>Neat! I'd like to help test your patch, if you wouldn't mind posting
>>>
>>>
>>it.
>>
>>
>>>Is there anything specific behavior (good or bad) you would like me
to
>>>check for?
>>>
>>>
>>Here is it. The patch is very sample. I didn't observe any side effect
>>of this patch, but maybe it must be tested widely. Could you please
try
>>it?
>>
>>
>Shaohua,
>
>My system has the same problem. Unfortunately, your patch doesn't fix
>it. Also, I had to apply the attached just to get it to build (against
>current -rc4 bitkeeper plus linux-acpi-test-2.6.8)
>
>Nathan

[-- Attachment #2: maskevent.patch --]
[-- Type: application/octet-stream, Size: 2101 bytes --]

===== drivers/acpi/bus.c 1.42 vs edited =====
--- 1.42/drivers/acpi/bus.c	2004-05-12 12:36:55 +08:00
+++ edited/drivers/acpi/bus.c	2004-08-12 14:39:43 +08:00
@@ -283,6 +283,7 @@ LIST_HEAD(acpi_bus_event_list);
 DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
 
 extern int			event_is_open;
+extern int			acpi_event_is_mask;
 
 int
 acpi_bus_generate_event (
@@ -299,7 +300,7 @@ acpi_bus_generate_event (
 		return_VALUE(-EINVAL);
 
 	/* drop event on the floor if no one's listening */
-	if (!event_is_open)
+	if (!event_is_open || acpi_event_is_mask)
 		return_VALUE(0);
 
 	event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
===== drivers/acpi/event.c 1.5 vs edited =====
--- 1.5/drivers/acpi/event.c	2004-05-29 17:12:55 +08:00
+++ edited/drivers/acpi/event.c	2004-08-12 14:40:13 +08:00
@@ -17,7 +17,8 @@ ACPI_MODULE_NAME		("event")
 
 /* Global vars for handling event proc entry */
 static spinlock_t		acpi_system_event_lock = SPIN_LOCK_UNLOCKED;
-int				event_is_open = 0;
+int				event_is_open;
+int				acpi_event_is_mask;
 extern struct list_head		acpi_bus_event_list;
 extern wait_queue_head_t	acpi_bus_event_queue;
 
===== drivers/acpi/sleep/main.c 1.38 vs edited =====
--- 1.38/drivers/acpi/sleep/main.c	2004-07-14 13:29:13 +08:00
+++ edited/drivers/acpi/sleep/main.c	2004-08-12 14:41:13 +08:00
@@ -70,7 +70,7 @@ static int acpi_pm_prepare(u32 pm_state)
  *	arch-specific assembly, which in turn call acpi_enter_sleep_state().
  *	It's unfortunate, but it works. Please fix if you're feeling frisky.
  */
-
+extern int acpi_event_is_mask;
 static int acpi_pm_enter(u32 pm_state)
 {
 	acpi_status status = AE_OK;
@@ -89,6 +89,7 @@ static int acpi_pm_enter(u32 pm_state)
 
 	local_irq_save(flags);
 	acpi_enable_wakeup_device(acpi_state);
+	acpi_event_is_mask = 1;
 	switch (pm_state)
 	{
 	case PM_SUSPEND_STANDBY:
@@ -139,6 +140,7 @@ static int acpi_pm_finish(u32 pm_state)
 
 	acpi_leave_sleep_state(acpi_state);
 	acpi_disable_wakeup_device(acpi_state);
+	acpi_event_is_mask = 0;
 
 	/* reset firmware waking vector */
 	acpi_set_firmware_waking_vector((acpi_physical_address) 0);

^ permalink raw reply	[flat|nested] 14+ messages in thread
* RE: bug in acpid scripts
@ 2004-08-12  7:07 Li, Shaohua
       [not found] ` <B44D37711ED29844BEA67908EAF36F038AD732-4yWAQGcml65pB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Li, Shaohua @ 2004-08-12  7:07 UTC (permalink / raw)
  To: russell-1vnkWVZi4QaVc3sceRu5cw
  Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: text/plain, Size: 2918 bytes --]

Russell Neches Sunday, July 25, 2004 9:42 AM wrote:
>To: Li, Shaohua
>Cc: ACPI-Devel
>Subject: RE: [ACPI] bug in acpid scripts
>
>Neat! I'd like to help test your patch, if you wouldn't mind posting
it.
>Is there anything specific behavior (good or bad) you would like me to
>check for?
Here is it. The patch is very sample. I didn't observe any side effect
of this patch, but maybe it must be tested widely. Could you please try
it?

Thanks,
Shaohua

>
>Russell
>
>On Sat, 2004-07-24 at 09:23, Li, Shaohua wrote:
>> I'm working to disable all events sent to acpid (of course including
>> button event) when system is resuming. The patch is very
>> straightforward. But I need time to verify if it has side effect for
>> acpid.
>>
>> Thanks,
>> Shaohua
>>
>> >-----Original Message-----
>> >From: acpi-devel-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:acpi-devel-
>> >admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Matthew Garrett
>> >Sent: Saturday, July 24, 2004 8:50 PM
>> >To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>> >Subject: Re: [ACPI] bug in acpid scripts
>> >
>> >On Fri, 2004-07-23 at 20:36, Russell Neches wrote:
>> >
>> >> 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.
>> >
>> >--
>> >Matthew Garrett | mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org
>> >
>> >
>> >
>> >-------------------------------------------------------
>> >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
>> >_______________________________________________
>> >Acpi-devel mailing list
>> >Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>> >https://lists.sourceforge.net/lists/listinfo/acpi-devel
>>
>>
>> -------------------------------------------------------
>> 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_idG21&alloc_id\x10040&op=click
>> _______________________________________________
>> Acpi-devel mailing list
>> Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>> https://lists.sourceforge.net/lists/listinfo/acpi-devel

[-- Attachment #2: maskevent.patch --]
[-- Type: application/octet-stream, Size: 2105 bytes --]

===== drivers/acpi/bus.c 1.42 vs edited =====
--- 1.42/drivers/acpi/bus.c	2004-05-12 12:36:55 +08:00
+++ edited/drivers/acpi/bus.c	2004-08-12 14:39:43 +08:00
@@ -283,6 +283,7 @@ LIST_HEAD(acpi_bus_event_list);
 DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
 
 extern int			event_is_open;
+extern int			acpi_event_is_masked;
 
 int
 acpi_bus_generate_event (
@@ -299,7 +300,7 @@ acpi_bus_generate_event (
 		return_VALUE(-EINVAL);
 
 	/* drop event on the floor if no one's listening */
-	if (!event_is_open)
+	if (!event_is_open || acpi_event_is_masked)
 		return_VALUE(0);
 
 	event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC);
===== drivers/acpi/event.c 1.5 vs edited =====
--- 1.5/drivers/acpi/event.c	2004-05-29 17:12:55 +08:00
+++ edited/drivers/acpi/event.c	2004-08-12 14:40:13 +08:00
@@ -17,7 +17,8 @@ ACPI_MODULE_NAME		("event")
 
 /* Global vars for handling event proc entry */
 static spinlock_t		acpi_system_event_lock = SPIN_LOCK_UNLOCKED;
-int				event_is_open = 0;
+int				event_is_open;
+int				acpi_event_is_mask;
 extern struct list_head		acpi_bus_event_list;
 extern wait_queue_head_t	acpi_bus_event_queue;
 
===== drivers/acpi/sleep/main.c 1.38 vs edited =====
--- 1.38/drivers/acpi/sleep/main.c	2004-07-14 13:29:13 +08:00
+++ edited/drivers/acpi/sleep/main.c	2004-08-12 14:41:13 +08:00
@@ -70,7 +70,7 @@ static int acpi_pm_prepare(u32 pm_state)
  *	arch-specific assembly, which in turn call acpi_enter_sleep_state().
  *	It's unfortunate, but it works. Please fix if you're feeling frisky.
  */
-
+extern int acpi_event_is_mask;
 static int acpi_pm_enter(u32 pm_state)
 {
 	acpi_status status = AE_OK;
@@ -89,6 +89,7 @@ static int acpi_pm_enter(u32 pm_state)
 
 	local_irq_save(flags);
 	acpi_enable_wakeup_device(acpi_state);
+	acpi_event_is_mask = 1;
 	switch (pm_state)
 	{
 	case PM_SUSPEND_STANDBY:
@@ -139,6 +140,7 @@ static int acpi_pm_finish(u32 pm_state)
 
 	acpi_leave_sleep_state(acpi_state);
 	acpi_disable_wakeup_device(acpi_state);
+	acpi_event_is_mask = 0;
 
 	/* reset firmware waking vector */
 	acpi_set_firmware_waking_vector((acpi_physical_address) 0);

^ permalink raw reply	[flat|nested] 14+ messages in thread
* RE: bug in acpid scripts
@ 2004-07-24 13:23 Li, Shaohua
       [not found] ` <B44D37711ED29844BEA67908EAF36F03665E4F-4yWAQGcml65pB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Li, Shaohua @ 2004-07-24 13:23 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

I'm working to disable all events sent to acpid (of course including
button event) when system is resuming. The patch is very
straightforward. But I need time to verify if it has side effect for
acpid. 

Thanks,
Shaohua

>-----Original Message-----
>From: acpi-devel-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:acpi-devel-
>admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Matthew Garrett
>Sent: Saturday, July 24, 2004 8:50 PM
>To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>Subject: Re: [ACPI] bug in acpid scripts
>
>On Fri, 2004-07-23 at 20:36, Russell Neches wrote:
>
>> 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.
>
>--
>Matthew Garrett | mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org
>
>
>
>-------------------------------------------------------
>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
>_______________________________________________
>Acpi-devel mailing list
>Acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>https://lists.sourceforge.net/lists/listinfo/acpi-devel


-------------------------------------------------------
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_idG21&alloc_id\x10040&op=click

^ permalink raw reply	[flat|nested] 14+ messages in thread
* bug in acpid scripts
@ 2004-07-23 19:36 Russell Neches
       [not found] ` <20040723193658.GA3331-5z3TbH0F9hyr8sbHwu5NIg@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Russell Neches @ 2004-07-23 19:36 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f


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

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-08-13  6:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-13  0:52 bug in acpid scripts Li, Shaohua
     [not found] ` <B44D37711ED29844BEA67908EAF36F038ADB3E-4yWAQGcml65pB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-08-13  0:55   ` Nathan Bryant
  -- strict thread matches above, loose matches on Subject: below --
2004-08-12  7:07 Li, Shaohua
     [not found] ` <B44D37711ED29844BEA67908EAF36F038AD732-4yWAQGcml65pB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-08-13  0:24   ` Nathan Bryant
2004-08-13  6:18   ` Stefan Seyfried
2004-07-24 13:23 Li, Shaohua
     [not found] ` <B44D37711ED29844BEA67908EAF36F03665E4F-4yWAQGcml65pB2pF5aRoyrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2004-07-25  1:42   ` Russell Neches
2004-07-23 19:36 Russell Neches
     [not found] ` <20040723193658.GA3331-5z3TbH0F9hyr8sbHwu5NIg@public.gmane.org>
2004-07-23 20:39   ` Vernon Mauery
     [not found]     ` <1090615197.9015.7.camel-DNmeG3802II@public.gmane.org>
2004-07-23 23:34       ` Russell Neches
2004-07-24 12:50   ` Matthew Garrett
     [not found]     ` <1090673420.4412.14.camel-myFlNLNQP+Q@public.gmane.org>
2004-07-24 13:51       ` Mattia Dongili
     [not found]         ` <20040724135111.GC2328-MEqNC12sBsHxa7XIdbXXog@public.gmane.org>
2004-07-24 14:40           ` Luca Capello
2004-08-11 13:40   ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox