|Version 1 (modified by kevin, 3 years ago)|
The A5 has only three hardware buttons, which nominally control power, volume up and volume down. If you're using udev, then the volume button events should appear at /dev/input1, while the power button event comes in to /dev/input0. Both these source are compatible with the X evdev driver and look like ordinary keypresses. However, in Angstrom Linux (and probably most other Linux flavours), only the volume buttons at input1 are mapped to the evdev driver. input0 generates no X events at all.
The reason for this is that the driver does no identify itself as having `input.keys' capability, so the standard HAL rules don't connect it to the appropriate X driver. The fix for this is to add the following <match> section to /usr/share/hal/fdi/policy/10osvendor/10-x11-input.fd:
<match key="input.product" string="atmega-key"> <merge key="input.x11_driver" type="string">keyboard</merge> <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" string="Linux"> <merge key="input.x11_driver" type="string">evdev</merge> </match> </match>
Note that although the volume and (with the above fix) power buttons can generate X events, the key codes are unlikely to be mapped onto anything useful. You'll probably need to xmodmap them to useful keysyms, according to what you want to do with them.
xmodmap -e 'keycode 123 = XF86AudioRaiseVolume' xmodmap -e 'keycode 122 = XF86AudioLowerVolume' xmodmap -e 'keycode 124 = XF86PowerOff'
You've still got the problem of finding software that will handle these keysyms and do something useful. The `keylaunch' utility provided with Angtrom is a possibility for simple jobs. It allows arbitrary keysyms to be mapped to shell commands. The following /etc/keylaunchrc might be a starting point:
key=????XF86AudioLowerVolume:~aumix -v -5 key=????XF86AudioRaiseVolume:~aumix -v +5
In addition, some window managers provide similar functionality. However, I had no success at all getting the Matchbox window manager, which is standard with Angstrom, to do anything useful with the volume keys.
All the hardware keys bounce ferociously. That is, they generate keyup/keydown events at speed so long as they are depressed. Whatever software you use to handle these keys needs to be able to cope with these multiple events. See also debouncing the touch panel.