Quote:
Originally posted by Ayukawa
I'm looking to get the one-touch buttons (and more importantly, the volume buttons) to work under linux on a HP Pavilion ze4900. However, while the omnibook module is loading, and cat /proc/omnibook/onetouch is telling me that the buttons are enabled, I am unable to set shortcuts in KDE.
|
I managed to get one-touch buttons working on my ze4900. Here's a mini-HOWTO:
The ze4900's multimedia keys require a new kernel module, a program for configuring the keys, and additional configuration at the command line (not in that order). The module you require is the Omnibook kernel module available at
http://www.sourceforge.net/projects/omke. This module builds without a hitch against kernel 2.6.9.
You also need xhkeys, a tool for configuring hotkeys under X:
http://freshmeat.net/projects/xhkeys/
here's what you have to do in order to get your fancy blue-lit keys working:
1. Compile and install the Omnibook kernel module according to directions. You'll need kernel source for this.
2. The kernel module recognizes several different protocols - you need protocol 7 (see the README). Insert the module like so:
modprobe omnibook ectype=7
3. Compile and install xhkeys according to directions. We'll get back to xhkeys in a moment.
4. With the Omnibook kernel module inserted, all of your multimedia keys will be recognized, though not useful at first. (Without the Omnibook module, only three or four of your one-touch keys will be recognized.) Now you have to associate the keys' scancodes with keycodes. Now wait, don't panic - this isn't that hard.
Each time you press a key, it emits a hexidecimal "scan code" which must be mapped to a "key code" stored in a table. The scan code indicates what button has been pressed; the key code indicates what that button should do. Before you inserted the driver, your one-touch keys weren't recognized; with the driver, the keys emit scan codes but aren't mapped to key codes.
You only really need three commands: setkeycodes, getkeycodes, and showkey. showkey -s will tell you what scan code a given key is associated with. getkeycodes will show you the scancode-to-keycode table, and setkeycodes will allow you to associate a scancode with a keycode. For more information on this, read the manual entry for setkeycodes.
5. Open a console and type tail -f /var/log/syslog. Press each of your multimedia buttons and watch the console - Linux will complain that it doesn't know what to do with them, and in the process give you the scancode you need. Write them down. If syslog doesn't complain about a given keypress, then there's already a keycode associated with that key (for me, this was the case with my volume keys and my web browser keys).
6. Once you have all the scancodes you need, type getkeycodes and take a look at the table that results. The left column consists of hexadecimal scancodes, while the remaining columns consist of decimal keycodes. This might be a little confusing, but it doesn't matter what keycode you choose so long as it's not already taken (e.g., if you choose a keycode for your mute button already used by the letter B, then B will no longer do what it's supposed to do). Don't worry about screwing up - rebooting the machine will reset the keycodes to their default. Go through the keycode table and pick out numbers not already in use - you'll need one for each new key.
7. Once you have all the numbers you need, scancode and keycode alike, use setkeycodes to associate the one-touch scancodes to your fresh new keycodes:
setkeycodes scancode keycode
For reference, here are my settings:
# mail key
setkeycodes e01e 120
# display key
setkeycodes e008 122
#lock key
setkeycodes e00a 123
# help key
setkeycodes e031 129
8. At a console, type xhkconf. xhkconf will ask you to press a key you'd like to mess with, and afterwards lead you through a configuration process. When you're done, type xhkeys and try one of the newly assigned keys to see if it works.
For reference, here are some commands you might find useful:
To raise volume (under ALSA): amixer -q -c0 sset Master,0 2%+,2%+
To lower volume (under ALSA): amixer -q -c0 sset Master,0 2%-,2%-
To mute/unmute volume: amixer sset Master toggle
To lock display (under X): xscreensaver-command -lock
To lock display (under KDE): dcop kdesktop KScreensaverIface lock
9. Once you're sure everything works, add modprobe omnibook ectype=7 as well as your setkeycodes commands to rc.local. Make sure your preferred desktop environment starts xhkeys, and you're all set.