You are not logged in.

#1 2011-11-22 02:36:14

ianhoolihan
Member
Registered: 2011-08-20
Posts: 85

Thinkpad X40 Hotkeys not work on update

Hi all,

I had finally sorted out my hotkeys using acpid, as in this post:

https://bbs.archlinux.org/viewtopic.php?id=130121

However, on updating with pacman, my acpi_listen events are now

button/fnf1 FNF1 00000080 00000000
button/battery BAT 00000080 00000000
button/screenlock SCRNLCK 00000080 00000000
button/sleep SBTN 00000080 00000000

for Fn+(F1-F4) respectively. So I tried to edit my handler.sh file to

#!/bin/bash

set $*

event="$1"\ "$2"\ "$3"\ "$4"

case "$event" in
    button/power*)
         logger "power button pressed; starting shutdown"
         `sudo shutdown -h now`
         ;;
    button/lid*)
         logger "acpid: Display lid action, suspending"
         /usr/sbin/pm-suspend ;;
    ac*0)
         logger "acpid: running on bat, activating powersave"
         /usr/bin/cpufreq-set -g powersave # load the powersave governor
         echo 0 > /sys/class/backlight/thinkpad_screen/brightness ;; # set brightness to the lowest level
    ac*1)
         logger "acpid: running on ac, activating ondemand"
         /usr/bin/cpufreq-set -g ondemand # load the ondemand governor
         echo 7 > /sys/class/backlight/thinkpad_screen/brightness ;; # set brighness to the highest level
    button/fnf1*) # Fn+F1
         logger "acpid: Fn+F1 pressed: set cpu_freq to ondemand"
         cpufreq-set -g ondemand ;; ###need to make user have this privelege
    button/battery*) # Fn+F2
         logger "acpid: Fn+F2 pressed: set cpu_freq to powersave"
         cpufreq-set -g powersave ;; ###need to make user have this privelege
    button/screenlock*) # Fn+F3
         logger "acpid: blank screen (Fn+F3) pressed; switching display off"
         sleep 1 && xset dpms force off ;;
    button/sleep*) # Fn+F4
         logger "acpid: sleep button (Fn+F4) pressed; initiating pm-suspend"
         /usr/sbin/pm-suspend ;;
    button/wlan*) # Fn+F5; toggle wireless on/off. This is built into hardware, so customization not needed
         logger "acpid: Fn+F5 pressed: toggle wireless"
    button/fnf6*) # Fn+F6;
         logger "acpid: Fn+F6 pressed: no action"
         ;;
    button/switchmode*) # Fn+F7
        logger "acpid: Fn+F7 pressed, toggling screen"
                case "$(/usr/bin/xrandr -q | grep VGA1)" in
                        *"1024x768"*) # external monitor is in use
                                case "$(/usr/bin/xrandr -q | grep LVDS1)" in
                                        *"1024x768"*) # LVDS1 is in use, so turn it off, and make VGA primary
                                                /usr/bin/xrandr --output LVDS1 --off ;;
                                        "LVDS1 connected (normal"*) # in other case (LVDS1 not connected)
                                                /usr/bin/xrandr --output VGA1 --off
                                                /usr/bin/xrandr --output LVDS1 --preferred ;;
                                esac
                        "VGA1 connected (normal"*) # external monitor is connected but not in use, switch on
                                /usr/bin/xrandr --output VGA1 --mode "1024x768" --above LVDS1 ;;
                        *) # any other case
                                logger "acpid: external screen not found" ;;
                esac
        ;;
    button/zoom*) # Fn+F8
         logger "acpid: zoom button (Fn+F8) pressed - no action"
         echo 3 > $beep ;;
    button/f24*) # Fn+F9;
         logger "acpid: Fn+F9 pressed: no action"
         ;;
    button/fnf10*) # Fn+F10;
         logger "acpid: Fn+F10 pressed: no action"
         ;;
    button/fnf11*) # Fn+F11;
         logger "acpid: Fn+F11 pressed: no action"
         ;;
    button/suspend*) # Fn+F12
         logger "acpid: hibernate button (Fn+F12) pressed: initiating hibernate"
         /usr/sbin/pm-hibernate ;;
    button/zoom*) # Fn+Space
         logger "acpid: zoom button (Fn+Space) pressed: no action"
         ;;
    button/prog1) # Access IBM
         logger "acpid: Access IBM button pressed: no action"
         ;;
    *) # Everything else
         logger "acpid: $event is not defined" ;;
esac

However, now none of these keys are working. It is somewhat annoying, as I only just got them working!

Any thoughts would be appreciated,

Ianhoolihan

Offline

#2 2011-11-26 14:51:26

David Batson
Member
Registered: 2011-10-13
Posts: 640

Re: Thinkpad X40 Hotkeys not work on update

ianhoolihan wrote:

However, on updating with pacman, my acpi_listen events are now

button/fnf1 FNF1 00000080 00000000
button/battery BAT 00000080 00000000
button/screenlock SCRNLCK 00000080 00000000
button/sleep SBTN 00000080 00000000

I can't get mine working in Arch XFCE either.  In Fedora 15 Gnome, I get the same acpi events as in Arch, but I can actually use them. 

In Arch If I call an action file in XFCE from: Applications Menu > Settings > Keyboard > Application Shortcuts, and use Fn + F3 (for instance) as the shortcut, XF86Battery is what is displayed as the shortcut.  Pressing Fn + F3 doesn't call the action file though.  If I do not assign Fn + F3 to this action file, pressing Fn + F3 does nothing except generate an acpi event.  BTW, I tried running the action file [root@myhost actions]# ./blank.sh and the file works (also works by running as a regular user), so the problem is not the action file.

Here is my action file: /etc/acpi/actions/blank.sh

#! /bin/sh

/usr/bin/xset dpms force off

In Fedora 15 Gnome, if I call the same action file in a similar way with the keyboard shortcut Fn + F3, Battery is what is displayed as the shortcut.  Pressing Fn + F3 runs the action file in Fedora.  If I do not assign Fn + F3 to this action file, Fn + F3 brings up a battery info dialog box (not unexpected).

Something is broken.  I don't think anyone has thinkpad_acpi working in an up-to-date Arch install.  Someone should file a bug report, but it won't be me.

EDIT:  I am using a Lenovo ThinkPad X220.

Last edited by David Batson (2011-11-26 14:56:09)

Offline

#3 2011-11-27 12:30:29

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: Thinkpad X40 Hotkeys not work on update

Something is broken.  I don't think anyone has thinkpad_acpi working in an up-to-date Arch install.  Someone should file a bug report, but it won't be me.

Thinkpad_acpi acpi signals doesn't work because it uses /proc, which is disabled now (as far as I have understood).  The bug should be filed upstream, if anything.

Ian,
I refactored my handler.sh file with  'new' non-Thinkpad acpi signals.  It works on my system.  Have you tried to bisec your handler file to locate potential bugs in it? (I had numerous 'bugs' in my handler file, making e.g. the sleep button not work)

--Rasmus


Arch x64 on Thinkpad X200s/W530

Offline

#4 2011-11-27 12:59:26

David Batson
Member
Registered: 2011-10-13
Posts: 640

Re: Thinkpad X40 Hotkeys not work on update

Pank wrote:

I refactored my handler.sh file with  'new' non-Thinkpad acpi signals.  It works on my system.

--Rasmus

Looks like a long road... hmm

I see that, but I never had to do that before.  In fact, Fedora and Mandriva did/do not have a handler.sh file (part of acpid) in /etc/acpi/ (older kernels though).

Offline

#5 2011-12-04 08:13:06

ianhoolihan
Member
Registered: 2011-08-20
Posts: 85

Re: Thinkpad X40 Hotkeys not work on update

Thankyou David and Rasmus.

I refactored my handler.sh file with  'new' non-Thinkpad acpi signals.  It works on my system.  Have you tried to bisec your handler file to locate potential bugs in it? (I had numerous 'bugs' in my handler file, making e.g. the sleep button not work)

Rasmus, I am not too clear on what you mean by 'new' or 'bisec' --- could you please elaborate?

Sorry for the brevity --- learning dvorak!

Ian

Offline

#6 2011-12-04 11:52:57

Pank
Member
From: IT
Registered: 2009-06-13
Posts: 371

Re: Thinkpad X40 Hotkeys not work on update

acpi_listen will tell you which signal each key generate.  E.g. Fn+F2 is button/screenlock on X200s. I have the following entry in my handler.sh

    button/screenlock*)
	logger "acpid: *lock* button (Fn+F2) pressed;"
	/etc/acpi/actions/lock.sh;;

If something doesn't work comment some of your config, reload, and see if it works.  If it works you know the error is in the area you commented.  If the error persists there is a good chance that there is no error in this area.


Arch x64 on Thinkpad X200s/W530

Offline

#7 2011-12-04 23:05:56

ianhoolihan
Member
Registered: 2011-08-20
Posts: 85

Re: Thinkpad X40 Hotkeys not work on update

OK, I managed to get at least some working by adding

export XAUTHORITY="$HOME/.Xauthority"
export DISPLAY=":0"

I've no idea why this works, but it does.

Offline

#8 2011-12-24 01:47:06

6arms1leg
Member
Registered: 2011-04-19
Posts: 22

Re: Thinkpad X40 Hotkeys not work on update

I updated my system now, too and i have the same problem on my t61p (hotkeys not working anymore; same "acpi_listen" output).

so "/proc" is disabled now in arch? but it still exists it on my newly updated system...
is there any chance that the "thinkpad_acpi" module gets updated in the near future? the information about "thinkpad_acpi" on the internet seems to be pretty out-dated (latest model mentioned often is t41). or do all thinkpad users have to switch to non-thinkpad hotkeys from now on?

although the quality of thinkpads decreased since lenovo took over, they are still the best notebooks out there and i liked using the hotkeys.

Offline

Board footer

Powered by FluxBB