You are not logged in.

#1 2008-06-27 02:44:53

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Suspend through HAL

According to some stuff I've read, gnome-power-manager and whatnot call pm-suspend via HAL when HAL detects a certain keystroke (e.g. Fn + F4 for Acer laptops). Is it possible to cut out the middleman and configure HAL to automatically invoke things when it detects Fn + F4 or some other keystroke? Can I modify some config file somewhere so that the suspend key actually runs pm-suspend, without bogging myself down configuring acpid?

Offline

#2 2008-06-29 03:16:17

matryc
Member
From: krakow.pl
Registered: 2008-06-26
Posts: 8

Re: Suspend through HAL

I have no idea how to configure it through HAL, but configuring acpid is pretty easy.
All you have to do is an action script, edit event script, and grab FN+F4 code from /var/log/acpid.log
So from the beginning, permissions:

xhost +local:root

Grab FN+F4 event code, by pressing this combination of keys. 3 times to be sure.
Now,

cat /var/log/acpid.log

and at the bottom you will see your 3 strikes, something like that:

[...]
Jun 29 04:15:25 thinkpad acpid: completed event "ibm/hotkey HKEY 00000080 00001004"
Jun 29 04:15:25 thinkpad acpid: received event "ibm/hotkey HKEY 00000080 00001004"

Now, when you have your event code you have to edit your event script, which is going to define, what action to do if the event is met.

So we are now going to edit the script, with your favourite text editor, lets say nano wink

nano /etc/acpi/events/sleep

this script contains what follows:

event=(button[ /]sleep|ibm/hotkey HKEY 00000080 00001004)
action=/etc/acpi/sleep.sh

double check the numbers (both strings must be identical of course)
now we have to make an action script which will put your laptop in a sleep state.

nano /etc/acpi/sleep.sh
#!/bin/sh

# remove USB 1.1 driver
rmmod uhci_hcd
# sync filesystem and clock
sync
/sbin/hwclock --systohc
# swich to console
chvt 6
# go to sleep
sleep 5 && echo -n "mem" > /sys/power/state
# readjust the clock
/sbin/hwclock --adjust
/sbin/hwclock --hctosys
# reload USB 1.1 driver
modprobe uhci_hcd
# insomnia? ;)
chvt 7

And the last touch:

chmod +x /etc/acpi/sleep.sh

Now you only have to restart the deamon:

./etc/rc.d/acpid restart

Last few words:
If your computer goes to sleep, but after awaking it screen stays black/blank (but not frozen, just black, with sounds, etc), you can try editing grub and pass command acpi_sleep=s3_bios to your kernel:

/boot/grub/menu.lst

title  Arch Linux
root   (hd0,0)
kernel /boot/vmlinuz26 root=/dev/sda1 ro vga=775 acpi_sleep=s3_bios
initrd /boot/kernel26.img

So configure it once and forget about it forever wink

Offline

#3 2008-06-29 03:22:04

Gullible Jones
Member
Registered: 2004-12-29
Posts: 4,863

Re: Suspend through HAL

Thanks, I didn't know I could get the keycode from acpid's log...

Last edited by Gullible Jones (2008-06-29 03:22:51)

Offline

Board footer

Powered by FluxBB