0

I have an old Thinkpad W510. The pm-suspend works, the lid close then suspend does not.

After some searching, I found the following solution.

  1. create /etc/acpi/events/lid (there's no lid related events, even the power management settings did set lid close to suspend)

the content is:

event=button/lid
action=/etc/acpi/lid.sh %e
  1. I then create lid.sh as follows,
echo "$1" | grep "button/lid" && grep -q open /proc/acpi/button/lid/LID/state && exit 0
pm-suspend

It shoud mean that, when lid/LID/state is open, then exit, otherwise, suspend.

However, the behavior is wierd now. When I close the lid, it does enter into suspend. But when I open the lid, it first wakes up from suspend, and then enters into suspend again (I have to press power button to wake it up from the auto-suspend after open)

I tried some other ways of writing the above lid.sh, such as,

grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
/usr/sbin/pm-suspend
fi

It's exactly the same behavior.

Anyone can show me any hints on why it behaves like "open the lid" -> "wake up" -> "suspend again immediately" ?

Thanks.

0

I had a similar issue. I was able to solve it by editing the file /etc/systemd/logind.conf

There is a line #HandleLidSwitch=suspend you can uncomment the line by deleting the # sign and change the value to poweroff, ignore, or suspend depending on what you want.

Maybe this does not cause the side effect you are experiencing. It worked for me.

I created a script to change the value more quickly. https://github.com/andreshazard/lidBehaviourScript

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.