1. The multimedia buttons
This part is quite easy. With "multimedia buttons" I refer to the buttons on the front (the three volume keys in the upper right corner of the keyboard work, too).
The only think you need is the file ~/.xbindkeysrc (see below). When this file exists xbindkeys is starting automatically with X/KDE (at least in my case - Gnome users please give a feedback). Disadvantage of this approach: it only works on X, not on console. But that's OK for me.
You can download my .xbindkeysrc here.
The code is quite selfexplaining. If you wonder why each volume keys has two amixer commands that is for controling both the internal speaker and the headphone plug at the same time. It's a "workaround" cause I don't know how to detect whether a headphone is plugged (like Windows does) -- but it works [TM].
Code: Select all
#*************************************#
# Make the hotkeys on Dell I6000 work #
#*************************************#
# The keycodes of the buttons can be read with xev
## Fn keys
# Fn + F1 --> Suspend to Disk
"sudo /usr/sbin/hibernate"
c:139 #220
# Fn + F10 --> Eject
"eject"
c:209 #246
## Volume settings (for both Speaker and Headphone)
# Mute/Unmute
"amixer set Master toggle && amixer set Headphone toggle"
c:160
# Lower Volume
"amixer set Master 5%- && amixer set Headphone 5%-"
c:174
# Raise Volume
"amixer set Master 5%+ && amixer set Headphone 5%+"
c:176
## Player settings
# Play/Pause
"amarok -t"
c:162
# Previous Track
"amarok -r"
c:144
# Next Track
"amarok -f"
c:153
# Stop
"amarok -s"
c:164
2. Hotkeys for ACPI events
seppelrockt wrote: I think the clearest setup would be like this:
Fn + Esc --> Suspend to RAM
Fn + F1 --> Suspend to Disk
Power button --> Power off Computer
Close LID --> Power off Display (Display must come back when LID opened)
2.1 Power button, LID open/close and Fn + Esc
This is the easier part of the ACPI events section. I assume you have Suspend-to-Disk and Suspend-to-RAM working and the following ebuilds installed: sys-power/acpid and sys-apps/vbetool.
Please check if acpid is in your runlevel, otherwise add it now:
Code: Select all
rc-update add acpid defaultCode: Select all
#!/bin/sh
#***********************************************#
# Customized acpi script for Dell Inspiron 6000 #
#***********************************************#
set $*
group=${1/\/*/}
action=${1/*\//}
case "$group" in
button)
case "$action" in
# Power button --> Power Off
power) logger "ACPI action: Power button" && \
sbin/init 0
;;
# Fn + Esc --> Suspend To RAM
# (works out of the box via BIOS)
sleep) logger "ACPI action: Sleep" && \
hibernate-ram &
;;
# Turn the display back on when LID opened
lid) grep -q open /proc/acpi/button/lid/LID/state && \
logger "ACPI action: LID OPEN" && vbetool dpms on
;;
# All other actions
*) logger "ACPI action $action is not defined"
;;
esac
;;
*)
logger "ACPI group $group / action $action is not defined"
;;
esac
2.2 The cursed Fn +F1 hotkey
Now we only have Fn + F1 --> Suspend to Disk left -- this one is realy tricky. The problem is that the hotkeys for ACPI events we have used 'til now are managed by the BIOS/kernel. But Fn + F1 is not implemented in the BIOS (thanks Dell!) and at least me can not write a kernel patch.
So we have to start from a situation like this (check your logs):
Code: Select all
atkbd.c: Unknown key pressed (translated set 2, code 0x87 on isa0060/serio0).
atkbd.c: Use 'setkeycodes e007 <keycode>' to make it known.
The first step is to assign kernel level keycodes to the hotkeys that are not managed by the BIOS. I added a keycode for Fn + F2 (wireless switch) too cause I later want to hack this to get a working WLAN LED.
I put the setkeycode commands in /etc/conf.d/local.start to call them on boot automaticaly. You can download the file here
Code: Select all
# /etc/conf.d/local.start
# This is a good place to load any misc programs
# on startup (use &>/dev/null to hide output)
## Assign keycodes to Dell Inspiron 6000 hotkeys
SKC=/usr/bin/setkeycodes
# Fn + F1 (hibernate hotkey)
$SKC e00a 120
# Fn + F2 (WLAN switch)
$SKC e008 121
# Fn + F10 (eject CDROM)
$SKC e009 122
To test if it works run ...
Code: Select all
/etc/init.d/local restartCode: Select all
showkeysDownload the kernel patch here
*** This is code too -- but I can't use the CODE tag here *** wrote: --- linux-2.6.16-suspend2-r4/drivers/input/keyboard/atkbd.c 2006-04-24 16:10:25.000000000 +0200
+++ linux-2.6.16-suspend2-r4/drivers/input/keyboard/atkbd.c 2006-05-24 00:26:12.534113096 +0200
@@ -398,6 +398,12 @@
default:
value = atkbd->release ? 0 :
(1 + (!atkbd->softrepeat && test_bit(atkbd->keycodeCode: Select all
, atkbd->dev->key))); + /* Workaround for Dell Inspiron 6000 laptop function keys + otherwise there is only a keypress and no keyrelease event */ + if (code >= 0x85 && code <= 0x8b) { + value = 3; + } + /* End of Dell Inspiron 6000 patch */ switch (value) { /* Workaround Toshiba laptop multiple keypress */ case 0: [/quote] Note: I have to put the CODE snipets into QUOTE tags from now on cause the forum software gets totaly fooled by this patch (it contains a CODE keyword itself). Seems like the whole world is one big workaround ;-) I assume you are familar with kernel compilation. Apply the patch from inside your kernel source dir with [quote="*** This is code too -- but I can't use the CODE tag here ***"] patch -p1 < /path/to/the/patch [/quote] and boot in your newly patched kernel. Now you should get proper keyrelease events for the hotkeys as well. But this are [i]kernel level[/i] keycodes that are translated into [i]X level[/i] keycodes by Xorg. In my .xbindkeysrc from above the (X level) keycodes are already written down -- you can get the X keycode of a key with [i]xbindkeys -k[/i]. The last problem is that /usr/sbin/hibernate can only be run as root --even the SETUID bit didn't help here cause the script checks it permissions by itself. [url=http://www.gentoo.org/doc/en/sudo-guide.xml][i]app-admin/sudo[/i][/url] comes in handy here cause it allows us to (passwordless) perform specified actions as non-root user that are otherwise only allowed to root. sudo is much safer then the SETUID bit anyway so give it a try. To run the hibernate script as non-root I have added the following lines to the config file /etc/sudoers (download the config [url=http://wwwhomes.uni-bielefeld.de/sroeder/sudoers]here[/url]) [quote="*** This is code too -- but I can't use the CODE tag here ***"] # Let all (local) users in group "wheel" suspend the maschine %wheel whiterabbit= NOPASSWD: /usr/sbin/hibernate [/quote] whiterabbit is the [i]hostname[/i] of my maschine so you have to adjust it to your needs -- I don't know why but localhost didn't work for me (also it works in general on my system, e.g. with CUPS). [b]3. Bonus features[/b] Try Fn + F10 and see what happens ;-) I didn't configure the Fn + F3 hotkey (yet) cause I don't know what to do with it ... On my ToDo is to use xbindkeys + sudo and a script or something to get a fully functional WLAN LED that is ON when the WLAN is on (no matter if it is actually connected to a AP or not) and OFF when ... well the WLAN is OFF. This involves module loading/unloading or maybe calling some init scripts/hotplug/coldplug whatever. If [i]you[/i] have ideas how to archive this feel free to write it down here ;-) [b]Afterword[/b] All the download files can be found [url=http://wwwhomes.uni-bielefeld.de/sroeder/]here[/url] I want to thank all the people in this thread who helped to sort out all the small and bigger problems with the Dell I6000 -- which works very smoothly today with Gentoo (thanks Gentoo Devs!). This is just a fragment of the in-the-works HowTo V2. Next "fragment" will be about Suspend modi I guess, befor I finally write down the whole thing "from the beginning" aka installing Gentoo from Scratch on the I6000. Stay tuned ... seppelrockt




