This is my 20€ wireless keyboard and mouse with extra multimedia buttons to control music applications.
They are located on the right side of the keyboard, and contain play/pause, rewind, fast forward, stop and mute buttons, and also a rotary wheel labeled "Volume". These buttons are a start for me to get interested in the way keyboards communicate with the computer ...
It works out of the box on my HP with UbuntuStudio 9.10 to control rhythmbox and to control the main volume of whatever outputs to the soundcard, Jack audio included so it's controlling the ALSA output volume I guess. I still dont know exactly. Here's some research ...
On my AVLinux Medion pc, the play, ffwd, rwd and stop buttons can be assigned to control Ardour or Qtractor, but this doesn't work in UbuntuStudio 9.10. In AVLinux, the control of the ALSA output volume doesn't work like it does in UbuntuStudio, but maybe that's because on my AVLinux install, I'm using a Delta 1010 soundcard. For my onboard card, amixer scontrols shows a 'Master' control but for the Delta 1010 there's no such control. A solution for that problem may be the one posted here on the Alsa-user mailing list, involving the use of pcm.softvol in /etc/asound.conf :
pcm.softvol {
type softvol
slave.pcm room1
control.name Master1
}
I should also connect some speakers to my onboard sound output to see if the wheel can control that volume.
UbuntuStudiuo: turning the wheel a lot makes gnome-settings-daemon take more cpu and memory (seen in top !), so that's probably the base for that wheel to function here. When I hit the play/pause frequently for a while, dbus-daemon and hald also appear in the running processes list of top.
AVLinux:
In synaptic, looking for "xkey", I see xkb-data 1.6-1ubuntu5 installed
and xkeycaps available for install. xkeycaps is a graphical front-end to xmodmap, which is part of the x11-xserver-utils package.
peter@hp-s3030:~$ apropos xmodmap
mk_modmap (8) - translate a Linux keytable file into an xmodmap file
xmodmap (1) - utility for modifying keymaps and pointer button mappi...
peter@hp-s3030:~$ xmodmap -pke | grep Audio
(In AVLinux, this command gives exactly the same result:)
keycode 121 = XF86AudioMute NoSymbol XF86AudioMute NoSymbol XF86AudioMute
keycode 122 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume
keycode 171 = XF86AudioNext NoSymbol XF86AudioNext NoSymbol XF86AudioNext
keycode 172 = XF86AudioPlay XF86AudioPause XF86AudioPlay XF86AudioPause XF86AudioPlay XF86AudioPause
keycode 173 = XF86AudioPrev NoSymbol XF86AudioPrev NoSymbol XF86AudioPrev
keycode 174 = XF86AudioStop XF86Eject XF86AudioStop XF86Eject XF86AudioStop XF86Eject
keycode 175 = XF86AudioRecord NoSymbol XF86AudioRecord NoSymbol XF86AudioRecord
keycode 176 = XF86AudioRewind NoSymbol XF86AudioRewind NoSymbol XF86AudioRewind
keycode 208 = XF86AudioPlay NoSymbol XF86AudioPlay NoSymbol XF86AudioPlay
keycode 209 = XF86AudioPause NoSymbol XF86AudioPause NoSymbol XF86AudioPause
keycode 215 = XF86AudioPlay NoSymbol XF86AudioPlay NoSymbol XF86AudioPlay
keycode 234 = XF86AudioMedia NoSymbol XF86AudioMedia NoSymbol XF86AudioMedia
more info about these codes is in /usr/include/X11/keysym.h and /usr/include/X11/keysymdef.h (see here)
Here's the full output of xmodmap -pke in case someone is looking for it.
This is some info about xmodmap from the terminal:
peter@hp-s3030:~$ xmodmap --help (usage)
peter@hp-s3030:~$ xmodmap -grammar (xmodmap accepts the following input expressions: ...)
The XF86Audio... therms are also used in the output of xev in AVLinux, but not in the output of xev in UbuntuStudio.
Xev is a program to print contents of X events.
Here's an interesting part of "man x" about keyboards:
The X keyboard model is broken into two layers:
server-specific codes (called keycodes) which represent the physical keys
server-independent symbols (called keysyms) which represent the letters or words that appear on the keys.
Two tables are kept in the server for converting keycodes to keysyms:
modifier list: Some keys (such as Shift, Control, and Caps Lock) are known as modifier and are used to select different symbols that are attached to a single key (such as Shift-a generates a capital A, and Control-l generates a control character ^L). The server keeps a list of keycodes corresponding to the various modifier keys. Whenever a key is pressed or released, the server generates an event that contains the keycode of the indicated key as well as a mask that specifies which of the modifier keys are currently pressed. Most servers set up this list to initially contain the various shift, control, and shift lock keys on the keyboard.
keymap table: Applications translate event keycodes and modifier masks into keysyms using a keysym table which contains one row for each keycode and one column for various modifier states. This table is initialized by the server to correspond to normal typewriter conventions. The exact semantics of how the table is interpreted to produce keysyms depends on the particular program, libraries, and language input method used, but the following conventions for the first four keysyms in each row are generally adhered to:
The first four elements of the list are split into two groups of keysyms. Group 1 contains the first and second keysyms; Group 2 contains the third and fourth keysyms. Within each group, if the first element is alphabetic and the the second element is the special keysym NoSymbol, then the group is treated as equivalent to a group in which the first element is the lowercase letter and the second element is the uppercase letter.
Switching between groups is controlled by the keysym named MODE SWITCH, by attaching that keysym to some key and attaching that key to any one of the modifiers Mod1 through Mod5. This modifier is called the ``group modifier.'' Group 1 is used when the group modifier is off, and Group 2 is used when the group modifier is on.
Within a group, the modifier state determines which keysym to use. The first keysym is used when the Shift and Lock modifiers are off. The second keysym is used when the Shift modifier is on, when the Lock modifier is on and the second keysym is uppercase alphabetic, or when the Lock modifier is on and is interpreted as ShiftLock. Otherwise, when the Lock modifier is on and is interpreted as CapsLock, the state of the Shift modifier is applied first to select a keysym; but if that keysym is lowercase alphabetic, then the corresponding uppercase keysym is used instead.