[Debian-eeepc-devel] Temporarily disabling lid-close-suspend

Phil Endecott spam_from_debian_eee at chezphil.org
Tue Sep 16 22:28:46 UTC 2008

Artur R. Czechowski wrote:
> On Tue, Sep 16, 2008 at 10:44:42PM +0100, Phil Endecott wrote:
>> # Ignore lid-open events
>> case `cat /proc/acpi/button/lid/LID/state` in
>> open)  exit 0 ;;
>> close) ;;
>> *)     # exit with a warning message maybe?
>> esac
> I like the idea.
>> I think that the main case to worry about here is where you close and 
>> then open before the suspend has actually happened.
> Why? You close the lid, suspend is started, then you open the lid and
> event is simply ignored.

With the addition of the code above, that is what happens.
What happens with the current code is more difficult to determine.  
It's quite possible that pm-suspend does something sensible if invoked 
twice.  I have a feeling that at some level the suspend API has a 
method to abort a suspend, which lid-open could trigger perhaps.

>> I would also like to do something about closing the lid after you've 
>> initiated a shutdown.  I think that there should be no suspend so that 
>> the shutdown can complete.
> It would be nice to have this feature too. But wait...
>> Is there a good way to detect that shutdown 
>> is in progress?
> I have seen it somewhere! /etc/acpi/actions/suspend.sh:
> if (runlevel | grep -q [06]) || (pidof '/sbin/shutdown' > /dev/null); then
>     exit 0
> fi
> So, suspend.sh itself checks if it could safely suspend machine.

Ah yes, well spotted.

Cheers,  Phil.

More information about the Debian-eeepc-devel mailing list