X.Org/Input drivers

From Gentoo Linux Wiki
Jump to: navigation, search

X.Org TOC


Contents

[edit] INPUT_DEVICES

INPUT_DEVICES is an alias for the x11-drivers/xf86-input-* packages, and in the case of x11-base/xorg-drivers, acts as "pull in" USE-Flags. So INPUT_DEVICES="synaptics" is the same as the USE-Flag input_devices_synaptics. Setting the INPUT_DEVICES variable is a good idea as it will make the emerge include your drivers or enable support for your input device.

To see what INPUT_DEVICES variables can be set, run,

emerge -pv xorg-drivers

and look at the the output following INPUT_DEVICES,

[ebuild  N    ] x11-base/xorg-drivers-... INPUT_DEVICES="...." VIDEO_CARDS="..."

Add the INPUT_DEVICES variable with the driver you want in /etc/make.conf,

Note: Note that INPUT_DEVICES may contain more than one driver. If this is the case for you, separate each driver with a space.
File: /etc/make.conf
...
INPUT_DEVICES="evdev synaptics"
...

[edit] evdev

The evdev driver configures your input devices, as needed, using HAL or udev. This allows for the X server to automatically detect the keyboard and mouse you're using for your input devices, and removes the need to specify your devices in xorg.conf. Also, it allows for hot-plugging keyboards, mice and the various devices you might find yourself having to unplug the devices from a running machine and later plugging the devices back into the same running machine.

Add INPUT_DEVICES with evdev set in /etc/make.conf -- no other devices need to be listed:

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

Depending on the version of xorg-server, you need to enable the hal or the udev USE flags (if applicable) on x11-drivers/xf86-input-evdev and x11-base/xorg-server. When both are applicable, you can enable both.

The HAL or udev daemons needs to be running when applicable, and your user must be part of the plugdev group. Naturally, your kernel must have Event interface enabled.

Linux Kernel Configuration: Enabling the Event Interface
Device Drivers -->
   Input device support  --->
       <*>   Event interface

[edit] Default Keymap

To check which keymap a running X session is using, run:

setxkbmap -print -verbose 10

To set the keymap for a running X session:

setxkbmap dvorak

To set the keymap for all X sessions

cp sudo cp /usr/share/X11/xorg.conf.d/10-evdev.conf /etc/X11/xorg.conf.d/10-evdev.conf nano -w /etc/X11/xorg.conf.d/10-evdev.conf

And add the line:

 Option "XkbLayout" "gb"

To the keyboard section of the evdev.conf

If you're starting X manually from the command line, adding setxkbmap to your ~/.xinitrc will set the keymap for that session:

File: ~/.xinitrc
...
setxkbmap -model logiaccess -layout ch -variant fr
...
[edit] HAL

HAL has been deprecated, see bug 313389, and x11-base/xorg-server Changelog for 2011-03-27.

If you want to override the default keymap settings -- which is US -- you'll need to copy /usr/share/hal/fdi/policy/10osvendor/10-keymap.fdi to /etc/hal/fdi/policy/10-my-keymap.fdi. Open /etc/hal/fdi/policy/10-my-keymap.fdi and change the layout and variant settings to your liking. If, for example, you want the German keymap with no dead keys, it might look like this,

File: /etc/hal/fdi/policy/10-keymap.fdi
...
<merge key="input.xkb.layout" type="string">de</merge>
<merge key="input.xkb.variant" type="string">nodeadkeys</merge>
....
[edit] udev

Using udev, the default input configuration is stored into /usr/share/X11/xorg.conf.d/10-evdev.conf.

If you want to modify any of them, you have to create a new config file into /etc/X11/xorg.conf.d/. If you want to create a new keyboard configuration, you have to create /etc/X11/xorg.conf.d/10-keyboard.conf. You can copy and modify the keyboard input class from /etc/X11/xorg.conf.d/10-evdev.conf.

Example, if you have a Logitech Access keyboard for the French part of Switzerland, you can use the following:

File: /etc/X11/xorg.conf.d/10-keyboard.conf
Section "InputClass"
    Identifier             "evdev keyboard catchall"
    MatchIsKeyboard        "on"
    MatchDevicePath        "/dev/input/event*"
    Driver                 "evdev"
    Option                 "XkbModel" "logiaccess"
    Option                 "XkbLayout" "ch"
    Option                 "XkbVariant" "fr"
EndSection
For an in-depth explanation, read
man xorg.conf
and
man evdev

Note that a list of keyboard layouts and models can be found in /usr/share/X11/xkb/rules/base.lst.

[edit] Troubleshooting

The first thing to do is to read /var/log/Xorg.0.log:

less /var/log/Xorg.0.log

If a problem occurs, be on the lookout for any lines beginning with (EE) which represent errors, and also (WW) which are warnings that could indicate other issues.

[edit] Multiple Keyboard Layouts

Below is an example of keyboard configuration. This example shows how to enable two keyboard layouts in order to be able to switch between these in your Window Manager. Note the XkbVariant option, which can be ignored in most configurations, but some regions needs it. (French Canadian [multi], French Swiss [fr], etc.)

File: /etc/X11/xorg.conf
Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "kbd"
    Option         "XkbModel" "pc105"
    Option         "XkbLayout" "us,ca(fr)"
    Option         "XkbVariant" ",multi"
EndSection

Since Xorg 1.8, all you have to do is to add the options from the preceding example into the input class section of /etc/X11/xorg.conf.d/10-keyboard.conf

  • The XkbModel is usually one of the following:
    • pc105: Identified by the Enter/Return key being two rows tall or a backwards L shape
    • pc104: Enter key is one row tall
    • pc102: Without Super or Windows key

[edit] Switching Multiple Keyboard Layout

To be able to easily switch keyboard layouts, modify the Options used in either of the above two methods. For example, to switch between a US and a Swedish layout using the Caps Lock key, use:

File: /etc/X11/xorg.conf.d/10-keyboard.conf
...
Option "XkbLayout"  "us, se"
Option "XkbOptions" "grp:caps_toggle"
...
Personal tools
In other languages