Search This Blog

Saturday, March 10, 2007

hibernate-ram,special keys,etc,on x60

At last,with a suspend2-sources-2.6.20,I have make the hibernate-ram work,it's great!I use acpid to grab fn+f4 or lid off to get hibernate-ram activate automatically:


x60 shelling # cat /etc/acpi/events/tp_hotkey
event=ibm/hotkey.*
action=/etc/acpi/actions/tp_hotkey.sh "%e"



x60 shelling # cat /etc/acpi/actions/tp_hotkey.sh
#!/bin/bash

#receive our hotkey event
event=$1

#ibm thinkpad x60 hotkeys
nop="ibm/hotkey HKEY 00000080 00000000"
fnf1="ibm/hotkey HKEY 00000080 00001001"
fnf2="ibm/hotkey HKEY 00000080 00001002"
fnf3="ibm/hotkey HKEY 00000080 00001003"
fnf4="ibm/hotkey HKEY 00000080 00001004"
fnf5="ibm/hotkey HKEY 00000080 00001005"
fnf6="ibm/hotkey HKEY 00000080 00001006"
fnf7="ibm/hotkey HKEY 00000080 00001007"
fnf8="ibm/hotkey HKEY 00000080 00001008"
fnf9="ibm/hotkey HKEY 00000080 00001009"
fnf10="ibm/hotkey HKEY 00000080 0000100a"
fnf11="ibm/hotkey HKEY 00000080 0000100b"
fnf12="ibm/hotkey HKEY 00000080 0000100c"
fnbksps="ibm/hotkey HKEY 00000080 0000100d"
#fnhome="ibm/hotkey HKEY 00000080 00001010"
#fnend="ibm/hotkey HKEY 00000080 00005010"
wireless_switch="ibm/hotkey HKEY 00000080 00007000"

case $event in
$nop)
;;
$fnf1)
;;
$fnf2)
/usr/bin/xscreensaver-command -lock
;;
$fnf3)
;;
$fnf4)
sudo /usr/sbin/hibernate-ram
;;
$fnf5)
;;
$fnf6)
;;
$fnf7)
;;
$fnf8)
;;
$fnf9)
;;
$fnf10)
;;
$fnf11)
;;
$fnf12)
;;
#$fnhome)
# echo 'up' > /proc/acpi/ibm/brightness
# ;;
#$fnend)
# echo 'down' > /proc/acpi/ibm/brightness
# ;;
$wireless_switch)
if [ -f /var/run/ipw3945d/ipw3945d.pid ]
then
/etc/init.d/ipw3945d stop
else
/etc/init.d/ipw3945d start
fi
;;
esac



x60 shelling # cat /etc/acpi/events/lm_lid
event=button[ /]lid
action=/etc/acpi/actions/lm_lid.sh %e



x60 shelling # cat /etc/acpi/actions/lm_lid.sh
#!/bin/bash

test -f /usr/sbin/hibernate-ram || exit 0

# lid button pressed/released event handler

#
#/usr/sbin/laptop_mode auto
/usr/sbin/hibernate-ram




The volume controlling keys are actually valid without any configuration,and using a tpb with xosd support,we can see it working;

And the BACK and FORWARD key need xmodmap:

x60 shelling # cat .Xmodmap
! Page left
keycode 234 = F19
! Page right
keycode 233 = F20

Now make a little mod to firefox:

#cd /usr/lib/mozilla-firefox/chrome
#unzip browser.jar

and add the following two lines (the lines with "TP") to content/browser/browser.xul:

<key id="goBackKb" keycode="VK_LEFT" command="Browser:Back" modifiers="alt"/>
<key id="goForwardKb" keycode="VK_RIGHT" command="Browser:Forward" modifiers="alt"/>
<key id="goBackTP" keycode="VK_F19" command="Browser:Back"/>
<key id="goForwardTP" keycode="VK_F20" command="Browser:Forward" />

restart firefox,now BACK makes firefox back and FORWARD makes firefox forward.

5 comments:

Anonymous said...

Hi, i have an x60 too, with gentoo + 2.6.24 kernel I have a little problem with
brightness adjustment with button i see that i haven't the /proc/acpi/ibm/brightness can you tell me something about? like some kernel modules that i forget?
Thanks a lot
cheers
Riccardo

Unknown said...

hi,Riccardo,
sorry to reply u till now,for blogspot was being masked from inside china so i can not see your comment.
may be you forget to install the "thinkpad_acpi" modules?

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...
This comment has been removed by a blog administrator.