Gentoo Wiki


 XOrg IndexConfigurationHIDevices
FontsVideo CardsMonitors  

The way, how input devices are configured in Xorg recently changed a lot. Xorg is pushing the generic input driver evdev (making the keyboard and mouse driver obsolete), which supports all keys and buttons of multimedia input devices, and the use of HAL to provide input hotplugging.


Basic Setup

Kernel Setup

Linux Kernel Configuration:
Device Drivers  --->
    Input device support  --->
        <*>   Event interface
         If you have a PS/2 mouse
        [*]   Mice  --->
              <*>   PS/2 mouse
      If you have an USB mouse
    [*] HID Devices  --->
        -*-   Generic HID support
        <*>   USB Human Interface Device (full HID) support

Xorg Setup

First add this line to your /etc/make.conf:

File: /etc/make.conf
INPUT_DEVICES="... evdev ...."

Also check with emerge --info | grep hal, that the hal USE flag is enabled. Then install Xorg:

# emerge --ask --verbose xorg-x11

or update your existing system:

# emerge -uDNva world

Now follow the Xorg guide to complete the setup and to start the X server.

Advanced Topics

Available Options

Today the input devices get configurated by HAL. The use of the xorg.conf for input configuration is deprecated. To add an option, you have to create a .fdi file. Here an example how to enable the emulation of the third (middle) button for 2-button mice:

File: /etc/hal/fdi/policy/99-x11-mouse.fdi
<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
    <match key="info.capabilities" contains="input.mouse">
      <merge key="input.x11_options.Emulate3Buttons" type="string">True</merge>

You can set all other options like this. Just add another <merge key="input.x11_options.Your Option" type="string">Your Value</merge> line. For more informations about HAL and .fdi files, see the HAL article.

For more options and their meanings, see the installed man page:

man evdev

Button Remapping

It may be, that the default configuration does not produce the desired results and you may have to manually remap the mouse buttons to the correct function. For this we need xinput:

emerge --ask --verbose xinput
Note: We've recorded already a lot of Individual Configurations about special xinput modifications. The xmodmap modifications can easily applied to xinput.

To apply xinput to your mouse (there may be more than one), we have to find out the right device name. Run xinput list shows all input devices. The quoted name the device name. Now you rearrange the buttons with:

xinput set-button-map <device name> <new button order>

Here an example:

xinput set-button-map "Logitech USB Mouse" 1 2 3 6 7 8 4 5

You can test the results of your remapping by running xev and pressing the button in question while keeping the cursor inside the black box in the window. It will give you a lot of information you don't need, but it will tell you which button X thinks it is once it's remapped. By default, X does sees all buttons as a 1-to-1 physical mapping with what the mouse driver tells it.

If your new config works well and you want to apply it automatically on each start, add a script in /etc/X11/xinit/xinitrc.d:

File: /etc/X11/xinit/xinitrc.d/99-xinput
xinput Your options

Afterwards make it executeable: chmod +x /etc/X11/xinit/xinitrc.d/99-xinput.



Uncontrollable mouse in SDL apps

It seems that with evdev, DGA gets broken in SDL: mouse jumps and moves down-right all the time. To fix this you have to add this to your /etc/X11/xorg.conf:

File: /etc/X11/xorg.conf
Section "Module"
   SubSection  "extmod"
      Option    "omit xfree86-dga"   # don't initialise the DGA extension
Retrieved from ""

Last modified: Fri, 03 Oct 2008 14:43:00 +0000 Hits: 641