ArchLinux: acpid with hotkey problems

Solaris, RedHat, FreeBSD and the like
Post Reply
Message
Author
tastatur
User with bad email address, PLEASE fix!
Posts: 27
Joined: Sun Sep 10, 2006 3:28 am
Location: Germany

ArchLinux: acpid with hotkey problems

#1 Post by tastatur » Mon Apr 07, 2008 3:47 am

I've followed this guide to configure my Fn-Key (T60) on ArchLinux: http://wiki.archlinux.org/index.php/IBM ... ction_Keys

The Script /etc/acpi/handler.sh will be executed by "root", so my suspend, blank-screen, bluetooth-toggle key, lid-close event work great. I have only problem with Fn-F2 to lock my screen by command: "gnome-screensaver-command -l"

This command must be executed under my linux-account and not root

Code: Select all

# BEGIN customization for ibm/hotkey:
   ibm)
    case "$event" in
        hotkey)
            case "$key" in
                "HKEY 00000080 00001002")
                    logger "acpid: lock button (Fn+F2) pressed"
                    su myusername -c "gnome-screensaver-command -l"
                    ;;
Restart my computer, Fn-F2 doesnt work. cat /var/log/acpid.log shows me that handler.sh was be called for HKEY 00000080 00001002 (it should be no problem at all) <--- i dont know why :?
Change to root account and restart acpid with /etc/rc.d/acpid restart . Now all Fn-keys work perfectly.......until next restart <--- i dont understand why :(
Can anyone help me to find a better solution ? Thanks very much :)

@tastatur
my email is "bad" ?? but it's real ;)

aaa
ThinkPadder
ThinkPadder
Posts: 1062
Joined: Fri Jun 08, 2007 2:36 pm

#2 Post by aaa » Mon Apr 07, 2008 4:47 am

I just mapped my AccessIBM key to locking (with Gnome).
But my FnF2 works:

Code: Select all

$ cat /etc/acpi/screenblank.sh
#!/bin/bash

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

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



$ cat /usr/share/acpi-suppor/screenblank
if [ `pidof xscreensaver` ]; then
        su $user -c "(xscreensaver-command -throttle)"
                if [ x$LOCK_SCREEN = xtrue ]; then      
                su $user -c "(xscreensaver-command -lock)"
        fi
fi

xset dpms force off
if [ x$RADEON_LIGHT = xtrue ]; then
    [ -x /usr/sbin/radeontool ] && radeontool light off
fi
One thing I notice is that you didn't set DISPLAY.

tastatur
User with bad email address, PLEASE fix!
Posts: 27
Joined: Sun Sep 10, 2006 3:28 am
Location: Germany

#3 Post by tastatur » Mon Apr 07, 2008 5:35 am

thank aaa for your reply. But DISPLAY=:0 su myusername -c "gnome-screensaver-command -l" doesnt help better.

Check /var/log/acpid.log i found that: before restarting acpid, there are always 2 clients connected.

Code: Select all

Apr  7 12:32:20 t60agnx acpid: received event "ibm/hotkey HKEY 00000080 00001001"
Apr  7 12:32:20 t60agnx acpid: notifying client 4305[82:82]
Apr  7 12:32:20 t60agnx acpid: notifying client 4301[0:0]
Apr  7 12:32:20 t60agnx acpid: executing action "/etc/acpi/handler.sh ibm/hotkey HKEY 00000080 00001001"
Apr  7 12:32:21 t60agnx logger: acpid: ibm/hotkey HKEY 00000080 00001001 is not defined
Apr  7 12:32:21 t60agnx acpid: action exited with status 0
Apr  7 12:32:21 t60agnx acpid: completed event "ibm/hotkey HKEY 00000080 00001001"
Apr  7 12:32:30 t60agnx acpid: received event "ibm/hotkey HKEY 00000080 00001002"
Apr  7 12:32:30 t60agnx acpid: notifying client 4305[82:82]
Apr  7 12:32:30 t60agnx acpid: notifying client 4301[0:0]
Apr  7 12:32:30 t60agnx acpid: executing action "/etc/acpi/handler.sh ibm/hotkey HKEY 00000080 00001002"
Apr  7 12:32:30 t60agnx logger: acpid: lock button (Fn+F2) pressed
Apr  7 12:32:30 t60agnx acpid: action exited with status 1
Apr  7 12:32:30 t60agnx acpid: completed event "ibm/hotkey HKEY 00000080 00001002"
and after restart: no more 4305[82:82]

Code: Select all

Apr  7 12:36:27 t60agnx acpid: exiting
Apr  7 12:36:27 t60agnx acpid: starting up
Apr  7 12:36:27 t60agnx acpid: 6 rules loaded
Apr  7 12:36:28 t60agnx acpid: client connected from 4301[0:0]
Apr  7 12:36:28 t60agnx acpid: 1 client rule loaded
Apr  7 12:36:31 t60agnx acpid: received event "ibm/hotkey HKEY 00000080 00001002"
Apr  7 12:36:31 t60agnx acpid: notifying client 4301[0:0]
Apr  7 12:36:31 t60agnx acpid: executing action "/etc/acpi/handler.sh ibm/hotkey HKEY 00000080 00001002"
Apr  7 12:36:31 t60agnx logger: acpid: lock button (Fn+F2) pressed
Apr  7 12:36:31 t60agnx acpid: action exited with status 0
Apr  7 12:36:31 t60agnx acpid: completed event "ibm/hotkey HKEY 00000080 00001002"
my email is "bad" ?? but it's real ;)

lightweight
Sophomore Member
Posts: 234
Joined: Sat Jun 30, 2007 10:56 pm
Location: L. A.

#4 Post by lightweight » Mon Apr 07, 2008 10:59 am

82:82 is the user:group controlling that process. Likely it's just the hardware abstraction layer (hald) using a socket to send requests to root's acpid (user 0:0).

Code: Select all

ps axu |grep acpi
grep 82:82 /etc/passwd
It echos back your Fn+F2 part so its failing on the su -c. Maybe gnome-screensaver is tricky or something dumb is happening with double quotes vs single quotes/enclosing the command in parenthesis. What happens when you use xscreensaver like aaa's example? (I also use xscreensaver.)

Is handler.sh only executable by root? If so try chmod'ing it 755.
Have: x60s ultralight 1705-CTO, Debian SiD, Linux 2.6.25-2 | x61s ultralight 7668-CTO, Debian SiD/Experimental, Linux 2.6.27-git5 | Model M 1391401, white label, 07-17-91
Had: x22, Debian Testing/SiD, Linux 2.6.18-22

tastatur
User with bad email address, PLEASE fix!
Posts: 27
Joined: Sun Sep 10, 2006 3:28 am
Location: Germany

#5 Post by tastatur » Mon Apr 07, 2008 1:07 pm

i traced back to find which process is [82:82] here.
ps axu |grep acpi:

Code: Select all

hal       4278  0.0  0.0   2000   892 ?        S    19:29   0:00 hald-addon-acpi
I think that my problem is not from gnome-screensaver or xscreensaver. I could change this command to call (for example) Firefox but without any succeed.

also after using this command i still only have process [0:0] on cat /var/log/acpid.log

Code: Select all

killall hald-addon-acpi

Code: Select all

Apr  7 20:03:36 t60agnx acpid: received event "ibm/hotkey HKEY 00000080 00001002"
Apr  7 20:03:36 t60agnx acpid: notifying client 4283[0:0]
Apr  7 20:03:36 t60agnx acpid: executing action "/etc/acpi/handler.sh ibm/hotkey HKEY 00000080 00001002"
Apr  7 20:03:36 t60agnx logger: acpid: lock button (Fn+F2) pressed
Apr  7 20:03:36 t60agnx acpid: action exited with status 1
Apr  7 20:03:36 t60agnx acpid: completed event "ibm/hotkey HKEY 00000080 00001002"
It looks like good right :D
action exited with status 1 --> error somewhere :(

I still cant use Fn-F2 if i dont restart acpid :)

Thank you all for your help and idea. Welcome to this challenge 8)
my email is "bad" ?? but it's real ;)

lightweight
Sophomore Member
Posts: 234
Joined: Sat Jun 30, 2007 10:56 pm
Location: L. A.

#6 Post by lightweight » Mon Apr 07, 2008 3:42 pm

How about starting acpid in verbose/debug mode in a terminal? It might spit out whats causing the su -c to exit 1. You'll want to restart after adding the -df flags. For example:

Code: Select all

io@shrimp:~$ ps ax | grep acpi
   47 ?        S<     0:00 [kacpid]
   48 ?        S<     0:00 [kacpi_notify]
 2924 ?        Ss     0:00 /usr/sbin/acpid -c /etc/acpi/events -s /var/run/acpid.socket
 3281 ?        S      0:00 hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
 4460 pts/1    S+     0:00 grep acpi
io@shrimp:~$ sudo kill 3281
io@shrimp:~$ ps ax | grep acpi
   47 ?        S<     0:00 [kacpid]
   48 ?        S<     0:00 [kacpi_notify]
 2924 ?        Ss     0:00 /usr/sbin/acpid -c /etc/acpi/events -s /var/run/acpid.socket
 4463 pts/1    R+     0:00 grep acpi
io@shrimp:~$ sudo kill 2924
io@shrimp:~$ sudo /usr/sbin/acpid -c /etc/acpi/events -s /var/run/acpid.socket -df
[Mon Apr  7 13:45:44 2008] starting up
[Mon Apr  7 13:45:44 2008] DBG: parsing conf file /etc/acpi/events/powerbtn
...
Have: x60s ultralight 1705-CTO, Debian SiD, Linux 2.6.25-2 | x61s ultralight 7668-CTO, Debian SiD/Experimental, Linux 2.6.27-git5 | Model M 1391401, white label, 07-17-91
Had: x22, Debian Testing/SiD, Linux 2.6.18-22

aaa
ThinkPadder
ThinkPadder
Posts: 1062
Joined: Fri Jun 08, 2007 2:36 pm

#7 Post by aaa » Mon Apr 07, 2008 5:31 pm

You can redirect output (using >>) to a file of your choosing, so you can see the error.

lightweight
Sophomore Member
Posts: 234
Joined: Sat Jun 30, 2007 10:56 pm
Location: L. A.

#8 Post by lightweight » Mon Apr 07, 2008 9:25 pm

Great idea, but FYI will want to redirect with 2>&1 to grab stderr.
Have: x60s ultralight 1705-CTO, Debian SiD, Linux 2.6.25-2 | x61s ultralight 7668-CTO, Debian SiD/Experimental, Linux 2.6.27-git5 | Model M 1391401, white label, 07-17-91
Had: x22, Debian Testing/SiD, Linux 2.6.18-22

tastatur
User with bad email address, PLEASE fix!
Posts: 27
Joined: Sun Sep 10, 2006 3:28 am
Location: Germany

#9 Post by tastatur » Tue Apr 08, 2008 12:11 pm

thanks for your tips. i'll try in this weekend after my.....laaaaast exam :D
my email is "bad" ?? but it's real ;)

tastatur
User with bad email address, PLEASE fix!
Posts: 27
Joined: Sun Sep 10, 2006 3:28 am
Location: Germany

#10 Post by tastatur » Wed Apr 09, 2008 8:13 pm

My newscript: /etc/acpi/screenblank.sh

Code: Select all

#!/bin/bash

umask 022;

getXuser() {
        user=`finger| grep -m1 ":$displaynum " | awk '{print $1}'`
	if [ x"$user" = x"" ]; then
		user=`finger| grep -m1 ":$displaynum" | awk '{print $1}'`
	fi
	if [ x"$user" != x"" ]; then
        	userhome=`getent passwd $user | cut -d: -f6`
        	export XAUTHORITY=$userhome/.Xauthority
	else
		export XAUTHORITY=""
	fi
}

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"
	if [ `pidof gnome-screensaver` ]; then
		su $user -c "(gnome-screensaver-command -a)"
		if [ x$LOCK_SCREEN = xtrue ]; then
		su $user -c "(gnome-screensaver-command -l)"
		fi
	fi
	xset dpms force off
	
    fi
done
Output from /var/log/acpid.log

Code: Select all

Apr 10 03:11:01 t60agnx acpid: completed event "ibm/hotkey HKEY 00000080 00001002"
Apr 10 03:12:41 t60agnx acpid: received event "ibm/hotkey HKEY 00000080 00001002"
Apr 10 03:12:41 t60agnx acpid: notifying client 4088[82:82]
Apr 10 03:12:41 t60agnx acpid: notifying client 4131[0:0]
Apr 10 03:12:41 t60agnx acpid: executing action "/etc/acpi/screenblank.sh"
Apr 10 03:12:41 t60agnx acpid: action exited with status 0
Apr 10 03:12:41 t60agnx acpid: executing action "/etc/acpi/handler.sh ibm/hotkey HKEY 00000080 00001002"
Apr 10 03:12:41 t60agnx acpid: action exited with status 0
Apr 10 03:12:41 t60agnx acpid: completed event "ibm/hotkey HKEY 00000080 00001002"
If i call /etc/acpi/screenblank.sh under root, it works perfectly: screensaver->turn off monitor->ask for password.
If i press Fn-F2, we'll get acpi event, this script will be executed with exit-status 0 -> But i dont see any screensaver, only off-screen by command xset dpms force off

:?
my email is "bad" ?? but it's real ;)

tastatur
User with bad email address, PLEASE fix!
Posts: 27
Joined: Sun Sep 10, 2006 3:28 am
Location: Germany

#11 Post by tastatur » Sun Apr 13, 2008 2:07 am

It seems to be impossible with me to run "any" command in handlers.sh. I tried to turn on all my hotkeys (echo > enable, 0x00ffffff > /proc/acpi/ibm/hotkey) then use gnome-keybinding-properties to bind Fn-F2 with Lock Screen. It works and it's only solution for me till now.

I want to continue with something to correct my screen brightness. Buttons Fn-Home and Fn-End works out of the box but the screen brightness meter (from gnome-power-manager) always show "null value". I've searched on google and found that HAL read value from /proc/acpi/ibm/brightness but i dont have /proc/acpi/ibm/brightness (i use thinkpad_acpi v0.17) anyone has idea :(

thanks all friends, who helped me lot with acpid problem 8)
@tastatur
my email is "bad" ?? but it's real ;)

aaa
ThinkPadder
ThinkPadder
Posts: 1062
Joined: Fri Jun 08, 2007 2:36 pm

#12 Post by aaa » Sun Apr 13, 2008 5:26 am

One thing I've noticed is that the brightness meter is broken in Ubuntu 7.10 (Gnome 2.20). The brightness can be changed, but there's no proper onscreen display, and the applet doesn't work right either. It work fine in the version before and after.

tastatur
User with bad email address, PLEASE fix!
Posts: 27
Joined: Sun Sep 10, 2006 3:28 am
Location: Germany

#13 Post by tastatur » Mon Apr 14, 2008 3:49 pm

First i can turn on my acpi/ibm/brightness again with 1 more line in modprobe.d: options thinkpad_acpi brightness_enable=1

the brightness meter (comes from gnome-power-manager) reads data from HAL, which reads data from /acpi/ibm/brightness
--> you can see this script: /usr/lib/hal/scripts/linux/hal-system-lcd-get-brightness-linux

If i can good remember, i think that everything from my T60 works perfectly with Gutsy Gibbon 7.10
Now i use Archlinux, /proc/acpi/ibm/brightness changes value when i change my backlight level as well, but the brightness meter doesn't show correctly :(
my email is "bad" ?? but it's real ;)

Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “Linux Questions”

Who is online

Users browsing this forum: axur-delmeria and 1 guest