[ltp] ACPI sleep when *opening* lid (T42p)

D. Sen linux-thinkpad@linux-thinkpad.org
Wed, 02 Feb 2005 08:46:56 +1100


Hi Marc,

I am missing `shlock` in my distribution (Mandrake 10.1). Is it a shell 
script?

Thanks,
DS

Marc MERLIN wrote:
> On Fri, Jan 21, 2005 at 07:27:26PM +1100, D. Sen wrote:
> 
>>It does seem that a second ACPI event is generated (5001) but it seems 
>>that it happens when I close the lid rather than when I open it. But I 
>>dont have an action setup for that event. Here are the relevant lines 
>>from my /var/log/acpid
>>
>>[Fri Jan 21 17:29:38 2005] received event "ibm/hotkey HKEY 00000080 
>>00005001"
>>[Fri Jan 21 17:29:38 2005] completed event "ibm/hotkey HKEY 00000080 
>>00005001"
>>[Fri Jan 21 17:29:38 2005] received event "button/lid LID 00000080 00000033"
>>[Fri Jan 21 17:29:38 2005] executing action "/etc/acpi/actions/lid.sh"
>>[Fri Jan 21 17:29:38 2005] BEGIN HANDLER MESSAGES
>>[Fri Jan 21 17:29:42 2005] END HANDLER MESSAGES
>>[Fri Jan 21 17:29:42 2005] action exited with status 0
>>[Fri Jan 21 17:29:42 2005] completed event "button/lid LID 00000080 
>>00000033"
>>
>>Any ideas?
> 
> 
> I just worked around this problem as such:
> (here's my swsusp script):
> ----------------------------------------------------------------------------
> #!/bin/bash
> 
> # swsusp for laptops (written for my Thinkpad T42p, but ought to work for
> # most other configurations)
> # By Marc MERLIN <marc_soft@merlins.org> v1.0
> # (gathered info and tips from many people)
> 
> # we can't test the sleep file before the previous invocation is gone
> # shlock comes from INN 
> shlock -f /var/run/sleep.lock -p $$
> 
> if [ $(( `date "+%s"` - `stat -c "%Z" /var/run/sleep 2>/dev/null` )) -lt 3 ]; then
>     echo "detected possible signal bounce, skipping" >&2
>     exit 0
> else
>     echo diff: $(( `date "+%s"` - `stat -c "%Z" /var/run/sleep 2>/dev/null` )) >&2 
> fi
> touch /var/run/sleep
> 
> # this is for USB to work when we come back from sleep
> /etc/init.d/hotplug stop
> /etc/init.d/irda-utils stop
> 
> # This doesn't seem to be needed for me
> #radeontool off
> 
> /etc/init.d/hwclock.sh stop
> echo 3 > /proc/acpi/sleep
> /etc/init.d/hwclock.sh start
> touch /var/run/sleep
> 
> #radeontool on
> 
> /etc/init.d/irda-utils start
> 
> /etc/init.d/hotplug start &
> 
> # I don't need this with X.org 6.8.1
> #/usr/local/bin/fakex 
> 
> /bin/rm /var/run/sleep.lock
> ----------------------------------------------------------------------------
> 
> If there is anything else than my swsusp script ought to have, please
> let me know
> 
> Marc

-- 
Dr. D. Sen
School of Electrical Engineering & Telecommunications
University of New South Wales
Sydney
NSW 2052
Australia
Tel: +612+93854754