On Sun, Nov 20, 2011 at 08:57:31PM -0600, Erik Johnson wrote:
On Sun, Nov 20, 2011 at 03:23:16PM -0600, Leonid Isaev wrote:

If plain pm-suspend works fine, this means that the lid close event is
triggered twice: on close and open. You can verify whether it is true by
replacing pm-suspend with logger "Some message" in handler.sh and see if there
are two messages in /var/log/messages.

--
Leonid Isaev
GnuPG key ID: 164B5A6D
Key fingerprint: C0DF 20D0 C075 C3F1 E1BE  775A A7AE F6CB 164B 5A6D

I had suspected that this was the case, but didn't have time to test
before writing my initial email. I've confirmed this behavior on my
netbook as well.

ejohnson@tardis:~% grep testacpid /var/log/everything.log
Nov 20 20:53:32 localhost testacpid: button/lid triggered
Nov 20 20:53:48 localhost testacpid: button/lid triggered


OK, I believe I have found why. I ran acpi_listen before closing the
lid, and observed the following:

button/lid LID close
button/lid LID open

Both events match "button/lid" in the case statement in handler.sh. I
took the default handler.sh from the acpid package and modified it so
that it checks the 3rd argument passed to handler.sh for "close" or
"open". I then added /usr/sbin/pm-suspend to the "close" section of the
newly-added case statement, tested, and confirmed that this fixed the
problem.

Patch attached. Will file a bug in flyspray.


--

-Erik

"For me, it is far better to grasp the universe as it really is than to
persist in delusion, however satisfying and reassuring."  --Carl Sagan

--- handler.sh  2011-10-07 14:17:32.000000000 -0500
+++ handler.sh.new      2011-11-20 21:46:57.131827682 -0600
@@ -57,8 +57,15 @@
         esac
         ;;
     button/lid)
-        #echo "LID switched!">/dev/tty5
-        ;;
+       case "$3" in
+               close)
+                       #echo "LID opened!">/dev/tty5
+                       ;;
+               open)
+                       #echo "LID closed!">/dev/tty5
+                       ;;
+       esac
+       ;;
     *)
         logger "ACPI group/action undefined: $1 / $2"
         ;;

Attachment: pgpnPQAGNKoLF.pgp
Description: PGP signature

Reply via email to