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.
- 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
- 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" ?