Input devices in Linux

This page contains descriptions on how to configure and use keyboards and Mice/trackballs in Linux.
[ Top | Bottom ]

Keyboards

Adding or remapping keys

Many keyboards contain extra keys often used for "multimedia" purposes, e.g. play/stop, mute, in/decrease volume and so on. Other keyboards may be missing a key that you normally use. To enable these keys, or remap them, run xev in a xterm and then press the key to see the keycode. The following is the result of pressing the "Logitech" key on my Logitech newtouch:
KeyRelease event, serial 26, synthetic NO, window 0xe00001,
	root 0x46, subw 0x0, time 2321622038, (246,229), root:(332,333),
	state 0x0, keycode 232 (keysym 0x0, NoSymbol), same_screen YES,
	XLookupString gives 0 characters:  ""
Code listing 2.1
From the above you can see that the key is not mapped to any symbol (NoSymbol). Now you can map this key (or remap it if it already has been assigned a symbol), to any arbitrary name which is not already used. In the following example "F20" is used: xmodmap -e "keycode 232 = F20". Now run xev again, and press the same key. It should say that the key is mapped to F20. You can then use the key in, for example, your window manager. I could add this to ~/.fluxbox/keys:
Mod1 F20 : ExecCommand xmms
Code listing 2.2

Meaning: pressing the Alt key and the "Logitech" key starts xmms.

To make these settings permanent, create a ~/.xmodmap file with the following contents:
keycode 232 = F20
Code listing 2.3
Make sure that the file is read every time you log into X by adding xmodmap ~/.xmodmap to either your ~/.xsession or ~/.xinitrc.

To enable the Windows keys make sure your X configuration file looks like this:

Section "InputDevice"
        ...
        Option      "XkbModel" "pc105"
        ...
EndSection
Code listing 2.4

For more information:

  • Google web directory: Linux keyboard support.
  • Linux support for Easy Access and Internet Keyboards: LinEak
[ Top | Bottom ]

Mice/Trackball

Scrolling

Just add this to your X configuration file:
Option "Protocol" "IMPS/2"
Option "ZAxisMapping" "4 5"
Code listing 3.1
to get a scroll wheel working.

Logitech Trackman Marble FX

The Logitech Trackman Marble FX is a bit different. A fourth button is used to activate scroll, and that is not supported until XFree86 4.2.0. With the help of this post (and it's kind author) I got it working. Modified the inputdevice section in the X configuration file to:
Section "InputDevice"
	Driver       "mouse"
	Identifier   "Mouse0"
	Option       "Device" "/dev/psaux"
	Option       "Name" "AutoDetected"
	Option       "Protocol" "Auto"
	Option       "Vendor" "AutoDetected"
	Option       "Buttons"       "4"  # Xorg version 6.8 and earlier
	Option       "XAxisMapping"  "6 7"
	Option       "YAxisMapping"  "4 5"
	Option       "EmulateWheel"  "true"
	Option       "EmulateWheelButton"  "4" # Xorg version 6.8 and earlier
#   Option       "EmulateWheelButton"  "8"  # Xorg version 6.9 and later
	# Amount to scroll:
	Option       "EmulateWheelInertia"  "12"  
EndSection
Code listing 3.2
NOTE! most apps only supports vertical scrolling, but some GTK+ 2 apps support both vertical and horizontal scrolling.

Mozilla Firefox interpretes horizontal scrolling as "back" and "forward" in page history. To disable this, enter: "about:config" in Firefox's address field, locate the key: "mousewheel.horizscroll.withnokey.action" and change its value to 0.

[ Top | Bottom ]

Wacom Graphire 4

If you use a kernel newer than 2.6.15 the wacom driver should be avaliable in the kernel, else download it from the Linux wacom site. It you have a kernel newer then 2.6.15, enable the following in your kernel:
Device Drivers  --->
    USB support  --->
        <M> Wacom Intuos/Graphire tablet support
Code listing 4.1
Futhermore you will need support for USB in your kernel.

Next you will have to configure your X server, add the following lines to your X configuration file:

Section "ServerLayout"
    ...
    InputDevice "stylus"  "SendCoreEvents"
    InputDevice "eraser"  "SendCoreEvents"
    InputDevice "cursor"  "SendCoreEvents"
    InputDevice "pad"
EndSection

Section "InputDevice"
  Driver        "wacom"
  Identifier    "stylus"
  Option        "Device"        "/dev/input/event2"   # USB ONLY
  Option        "Type"          "stylus"
  Option        "USB"           "on"                  # USB ONLY
EndSection

Section "InputDevice"
  Driver        "wacom"
  Identifier    "eraser"
  Option        "Device"        "/dev/input/event2"   # USB ONLY
  Option        "Type"          "eraser"
  Option        "USB"           "on"                  # USB ONLY
EndSection

Section "InputDevice"
  Driver        "wacom"
  Identifier    "cursor"
  Option        "Device"        "/dev/input/event2"   # USB ONLY
  Option        "Type"          "cursor"
  Option        "USB"           "on"                  # USB ONLY
EndSection

# This section is for Intuos3, Cintiq 21UX, or Graphire4 only
Section "InputDevice"
  Driver        "wacom"
  Identifier    "pad"
  Option        "Device"        "/dev/input/event2"   # USB ONLY
  Option        "Type"          "pad"
  Option        "USB"           "on"                  # USB ONLY
EndSection
Code listing 4.2
Restart X, and now you shoul be able to use it. Try to start The Gimp, and look in the preferences under "input devices".
[ Top | Bottom ]
Hi! you have reached the old part of my homepage, be sure to checkout my new site