[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: LID button Event ACPI malfunction

On Tuesday 21 December 2004 19:27, Benedek Frank wrote:

> /proc/acpi/button/lid/LID0/state
> it says
> state: closed
> It is clearly not closed, as I am looking at the screen. :)

No surprise to me.  The actual event posted by ACPI (at least on my Inspiron - 
it may well differ machine to machine) is merely a counter of the number of 
times the lid has been opened _or_ closed.  Mine is currently showing the 
correct value in  /proc/acpi/button/lid/LID/state, but I shouldn't think it's 
hard to confuse it.
> I have an ACPI event that gets triggered when I REALLY close the lid, and
> that works.
> Here is the event
> /etc/acpi/event/lidbtn
> event=button/lid
> action=/etc/acpi/lidbtn.sh
> And here is the script
> /etc/acpi/lidbtn.sh
> #!/bin/sh
> /sbin/sleep

So what happens when you _open_ the lid?  While there may be different events 
for opening and closing, you're triggering sleep for _any_ lid event.

It looks like it's working as designed :-)  My guess from your description is 
that you issued a shutdown, closed the lid (triggered one sleep), opened the 
lid (triggered another sleep) and then let it finish its job.  

Turn off acpid, cat /proc/acpi/event and watch what happens as you open and 
close the lid.  If the event really differentiates between open and closed, 
change the event/lidbtn event to catch just the _close_ event.  Otherwise, 
you'll have to rely on the contents of  /proc/acpi/button/lid/LID0/state and 
test for it.  

Then you also need something for shutdown that prevents the lid event 
triggering your sleep script if you close the lid before shutdown is 
complete.  It's probably simplest just to make sure that the very first thing 
you do during shutdown is kill acpid.

Reply to: