Comment 23 for bug 863834

Revision history for this message
Sauthess (sauthess) wrote :

Hi all,

Same problem here with a pavilion dm4 1162sf.

acpi_listen give me this :
button/lid LID0 00000080 00000005 -> lid close event
button/lid LID0 00000080 00000006 -> lid open event
button/lid LID0 00000080 00000007 -> lid close event
button/lid LID0 00000080 00000008 -> lid open event

This is incremental, starting by "00000001" on the first close event...

the /proc/acpi/button/lid/*/state stays always "open" so the script will never catch it as it is today (on other systems like arch linux with 3.1.4-1-ARCH kernel) , the acpi events where clearer with "button/lid LID open" and "button/lid LID close".

I think all is due to this strange information given in acpi events...

Here are the 2 scripts I used for a workaround on my system (I didn't edit directly lid.sh as I want it solved without breaking my actual workaround...) :

cat /etc/acpi/events/lidbtn
# /etc/acpi/events/lidbtn
# Called when the user closes or opens the lid

event=button[ /]lid
action=/etc/acpi/lid2.sh "%e"

cat /etc/acpi/lid2.sh
#!/bin/bash
# TODO: Change the above to /bin/sh

test -f /usr/share/acpi-support/state-funcs || exit 0

. /usr/share/acpi-support/power-funcs
. /usr/share/acpi-support/policy-funcs
. /etc/default/acpi-support

[ -x /etc/acpi/local/lid.sh.pre ] && /etc/acpi/local/lid.sh.pre

PARAM=$(echo $1 | awk '{print $4}')
PARAM2=$(expr `echo $((0x$PARAM))` % 2)

if [ `CheckPolicy` = 0 ]; then exit; fi

if [ $PARAM2 != 0 ]
then
    for x in /tmp/.X11-unix/*; do
 displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
 getXuser;
 if [ x"$XAUTHORITY" != x"" ]; then
     export DISPLAY=":$displaynum"
     . /usr/share/acpi-support/screenblank
 fi
    done
    dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
else
    for x in /tmp/.X11-unix/*; do
 displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
 getXuser;
 if [ x"$XAUTHORITY" != x"" ]; then
     export DISPLAY=":$displaynum"
     grep -q off-line /proc/acpi/ac_adapter/*/state
     if [ $? = 1 ]
  then
  if pidof xscreensaver > /dev/null; then
      su $user -c "xscreensaver-command -unthrottle"
  fi
     fi
     if [ x$RADEON_LIGHT = xtrue ]; then
  [ -x /usr/sbin/radeontool ] && radeontool light on
     fi
     if [ `pidof xscreensaver` ]; then
  su $user -c "xscreensaver-command -deactivate"
     fi
     su $user -c "xset dpms force on"
 fi
    done
fi
[ -x /etc/acpi/local/lid.sh.post ] && /etc/acpi/local/lid.sh.post

after a reboot, all is ok now....