The Multimedia Scroll Keyboard KB-2200 manufactured by Trust, is a USB keyboard, with a plethora of extra keys — sometimes referred to as multimedia keys — that can be used to launch applications, or to perform other useful actions. This document provides information on how to configure your Ubuntu system to make use of all these keys.

Introduction

The KB-2200 is a budget keyboard, and is available in many a bargain bin or budget shop. Without any configuration, the keyboard will work under any modern computer, but a number of the extra keys will not function without some further actions. This is perhaps due to the odd technical design of the keyboard. As far as the computer is concerned, this piece of hardware is a USB keyboard with a lot of keys, and a USB mouse with some more keys (or buttons), all in one.

IconsPage/note.png I have found no other information on the Internet about using this keyboard under Linux. If you follow this guide and find mistakes, or even if it all works or if you know of a better, easier method, please contact the author (ubuntu@jeroenhoek.nl). I would appreciate the feedback.

If we look at the input device entries our computer found for this keyboard, we see something like the following output:

# ls /dev/input/by-id -l
usb-062a_USB-compliant_keyboard-event-kbd -> ../event1
usb-062a_USB-compliant_keyboard-event-mouse -> ../event2
usb-062a_USB-compliant_keyboard-mouse -> ../mouse1

The mouse device will automatically work. Most of the time the X windowing system already uses the combined /dev/input/mice device, so all mice connected will work.

Of the two event interfaces, however, only one is handled by the standard keyboard driver used by default. There are nine keys that send their signals through the second interface, so we need to use it as well if we want all the keys to work.

Configuring all the relevant software

IconsPage/warning.png There is no easy way to make this keyboard work completely under Linux at the moment of writing. The actions below affect your system and a mistake can disable your graphical environment. This document requires some experience with the command line interface.

Without using the evdev driver in the X configuration, some of the keys on the keyboard do not generate keyevents. So first we need to configure X to use the keyboard through the evdev driver as well as the standard kbd keyboard driver. After that, a number of keys will be mapped to the wrong keysyms and a couple of keysyms appear twice, which causes some difficulty with the keyboard shortcuts configuration tool in Gnome, so we have to load a mapping for this keyboard using xmodmap. Finally, because a number of keys accessed through the evdev driver behave like mouse buttons, we link these to the keysyms we want to assign them using xbindkeys and xvkbd.

The X server

We want to add the second event interfaces as an input device for the graphical environment, but because we are working with a USB device, we do not know for sure if it will always be assigned the exact same device name. Ostensibly, the symlinks found in /dev/input/by-id are persistent and therefore useful, but unfortunately — at least up to Ubuntu 7.10 Gutsy Gibbon — the evdev driver we will use in the X server configuration does not accept those paths as an argument for the device. We can also refer to the name of the device, which is unique, but as noted above, there is more than one event device for this one keyboard, and they share the same name. To solve this, we refer to them by their physical path as well. The whole physical path is different for every USB port on your computer, but the last part is always the same for the device we want to use, namely /input1.

By referring to the devices in this manner, we can plug the keyboard into another USB port, and it will work without any changes in the configuration.

Open the X configuration file in /etc/X11/xorg.conf and add the following two device:

Section "InputDevice"
        Identifier      "USB Keyboard part 2"
        Driver          "evdev"
        Option          "Name" "USB-compliant keyboard"
        Option          "Phys" "*/input1"
        Option          "SendCoreEvents" "true"
        Option          "evBits" "+0-3 -4-23"
EndSection

Also, add the this new device to the server layout section in the same file:

Section "ServerLayout"
        Identifier      "Default Layout"
        screen 0 "Default Screen" 0 0
        Inputdevice     "Generic Keyboard"
        Inputdevice     "Configured Mouse"
        Inputdevice     "USB Keyboard part 2" "SendCoreEvents"
EndSection

After restarting the X server, every button should generate some output when pressed if you run xev in a terminal.

Xmodmap

Some of the multimedia keys are already recognized by the X server, but some of them are mapped to two keycodes. With Xmodmap we can assign the proper keysyms to all the keys. A good place to put the following configuration is in /etc/X11/Xmodmap, because the login manager GDM will also use it automatically:

! Euro currency
keycode  14 = 5 percent EuroSign 
! Yen currency
keycode  29 = y Y U00A5
! Arrow characters: ← ↑ ↓ →
keycode  98 = Up Up U2191
keycode 100 = Left Left U2190
keycode 102 = Right Right U2192
keycode 104 = Down Down U2193
! Compose key
keycode 113 = Multi_key Meta_R Alt_R
! Third level chooser
keycode 116 = Mode_switch Super_R
keycode 117 = Menu
keycode 118 =
keycode 121 = XF86AudioMute
keycode 122 = XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume
keycode 124 = XF86PowerDown
keycode 125 =
keycode 126 =
keycode 127 =
keycode 128 =
keycode 129 = XF86Launch1
keycode 131 = XF86Launch0
keycode 132 =
keycode 133 = XF86LaunchB
keycode 144 = XF86Search
keycode 148 = XF86Calculator
keycode 150 = XF86ScreenSaver
keycode 152 = XF86MyComputer
keycode 153 =
keycode 156 =
keycode 159 =
keycode 160 =
keycode 161 =
keycode 162 =
keycode 163 = XF86Mail
keycode 164 = XF86Tools
keycode 165 =
keycode 171 = XF86AudioNext
keycode 172 = XF86AudioPlay
keycode 173 = XF86AudioPrev
keycode 174 =
keycode 176 =
keycode 178 =
keycode 179 = XF86AudioStop
keycode 180 = XF86Explorer
keycode 181 = XF86WWW
keycode 204 =
keycode 205 =
keycode 208 = XF86Launch2
keycode 209 = XF86LaunchA
keycode 223 =
keycode 229 =
keycode 230 =
keycode 231 =
keycode 232 =
keycode 233 =
keycode 234 =
keycode 235 =
keycode 236 =
keycode 237 =
keycode 247 = XF86Launch3
keycode 248 = XF86Launch4
keycode 249 = XF86Launch5
keycode 250 = XF86Launch6
keycode 251 = XF86Launch7
keycode 252 = XF86Launch8
keycode 253 = XF86Launch9
keycode 254 = XF86LaunchC
keycode 255 = XF86LaunchD

clear mod1
add mod1 = Alt_L
clear mod4
add mod4 = Super_L
clear mod5
add mod5 = Mode_switch

The keycodes from 247 onwards are used for a number of the multimedia keys which are seen as mouse buttons. These codes are not used, but if we don’t define their keysyms somewhere some applications — most notably, the Gnome keyboard shortcut manager — will ignore the keys.

You can change this xmodmap to suit your own needs. I have added the Euro currency sign to the 5 key, because it has a label for it. You can access it by simultaneously pressing the right “Windows” key and the 5. I also added the Yen currency sign to the Y key, and the arrow characters to the arrow keys in the same way. The Alt Gr key is defined as the [compose] key.

To make this keymap available to all users, you can simply create a symlink to the above file in their home folder:

ln -s /etc/X11/Xmodmap /home/user/.Xmodmap

Xbindkeys and Xvkbd

If Xbindkeys and Xvkbd are not installed, do so first:

sudo apt-get install xbindkeys xvkbd

We assign keysyms to the nine buttons that were not recognized at first. Add this configuration to a file called /etc/xbindkeys:

"xvkbd -text '\[XF86Launch4]'"
  b:22
"xvkbd -text '\[XF86Launch5]'"
  b:26
"xvkbd -text '\[XF86LaunchC]'"
  b:27
"xvkbd -text '\[XF86LaunchD]'"
  b:28
"xvkbd -text '\[XF86Launch6]'"
  b:29
"xvkbd -text '\[XF86Launch7]'"
  b:30
"xvkbd -text '\[XF86Launch8]'"
  b:31
"xvkbd -text '\[XF86Launch3]'"
  b:32
"xvkbd -text '\[XF86Launch9]'"
  b:33

# Other examples:
#"xset dpms force suspend"
#  XF86ScreenSaver

#"scim-tomoe"
#  XF86LaunchA

#"gjiten"
#  XF86Tools

"nautilus --browser computer:///"
  XF86MyComputer

Add the command xbindkeys -f /etc/xbindkeys to the session startup for the user. In Gnome you can add this in Preferences » Sessions.

Finishing up

In Gnome, you can safely use the Preferences » Keyboard Shortcuts configuration tool to use your keys to launch applications. An excellent usage of the four little keys above the F7, F8 and F9 keys is to use them to switch to another workspace.

Music player daemon (mpd)

If you use mpd to play music, the following binds for xbindkeys might be useful. Add these to .xbindkeysrc:

"mpc next"
  XF86AudioNext
"mpc prev"
  XF86AudioPrev
"mpc stop"
  XF86AudioStop
"mpc toggle"
  XF86AudioPlay

Open issues

When everything is set up, you should probably no longer use the Preferences » Keyboard configuration tool in Gnome, because it will override our xmodmap settings. This should not be a problem, because we can set most of the options in there through our own xmodmap, but you may want to remove the entry from the menu so your users do not accidentally try to use it.

Related links

TrustMultimediaScrollKeyboardKB-2200 (last edited 2013-12-13 20:59:13 by knome)