Hi!
I recently found out that some machines have bugs that can send the acpi
events twice, this should problably be fixed on the BIOS if the problem is
on their ACPI code (but we know how most makers work on this regard),
sometimes the problem is that the user (or his/her baby) presses the button
several times thinking that it hasn't worked the first time, on any of this
cases if the event was to hibernate you'll get an hibernation and then as
many as the events that have been generated on waking up.
I believe that adding some locking mechanism on the event handling code on
the scripts could easily solve this processing for example just one button
at the same time or one button of the same kind at the same time.
I have done some testing about this, my code being somthing like this...
if lockfile -r0 /etc/acpi/powerbtn.lock
then
pm-hibernate
# this needs to be run on the background otherwise events will not be
# processed while the lock is on and just wait for us to finish
( sleep 2 ; rm -f /etc/acpi/powerbtn.lock ) &
fi
and found it to work perfectly, even though I would press the button lots of
time while we were hibernating.
Another thing I'd like to see is that the hibernate.sh script should include
the same screen locking code that the suspend script has right now, I never
understook why one has that code and the other doesn't.
Thanks in advance.