Skip to content

Configuring X input devices through HAL

When I went from < 7.3 to > 7.3, I had to make some changes to my X input configuration.

First of all, I had to replace x11-drivers/synaptics ( with the newer x11-drivers/xf86-input-synaptics, which is automatically installed if you set INPUT_DEVICES="${INPUT_DEVICES} synaptics" or if you add “x11-base/xorg-server input_devices_synaptics” to /etc/portage/package.use.

Starting with 7.3, you’re supposed to use HAL for all the X input configuration. All the "InputDevice" sections have to be removed from xorg.conf (and of course the references in "ServerLayout"). If you don’t want this, you can add the following options:

Section "ServerFlags"
  Option "AllowEmptyInput" "off"
  Option "AutoEnableDevices" "off"

I chose HAL. I wanted to replicate the following settings using HAL.

Section "InputDevice"
    Identifier "Keyboard1"
    Driver     "kbd"
    Option "AutoRepeat" "500 30"
    Option "XkbRules"  "xorg"
    Option "XkbModel"  "thinkpadintl"
    Option "XkbLayout" "us"
    Option "XkbOptions"        "ctrl:nocaps,altwin:menu,compose:ralt,eurosign:e"
Section "InputDevice"
    Identifier "Synaptics Touchpad"
    Driver     "synaptics"
    Option "SendCoreEvents" "true"
    Option "Device" "/etc/psaux"
    Option "Protocol"    "auto-dev"    # Auto detect
#    Option "TouchpadOff" "1" #Uncomment if you just want to disable the touchpad and use only the trackpoint
#    Option "HorizScrollDelta" "0" #Why is this in here by default. By Gods, it kill horizontal scrolling!
    Option "RightEdge" "5500" #This is a little bigger than the default narrowing the scroll region
    Option "BottomEdge" "4500" #This is a little bigger than the default narrowing the scroll region
    Option "RTCornerButton" "0" #disable Right Top corner "button" 
    Option "RBCornerButton" "0" #disable Right Top corner "button" 
    Option "SHMConfig" "on" #this allows configuration of the touchpad using qsynaptics, synclient, or what have you

The keyboard part was easy. I copied /usr/share/hal/fdi/policy/10osvendor/10-keymap.fdi to /etc/hal/fdi/policy/99-keymap.fdi and made a few adjustments:

<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->
<deviceinfo version="0.2">
    <match key="info.capabilities" contains="input.keymap">
      <append key="info.callouts.add" type="strlist">hal-setup-keymap</append>
    <match key="info.capabilities" contains="input.keys">
      <merge key="input.xkb.rules" type="string">xorg</merge>
      <!-- If we're using Linux, we use evdev by default (falling back to
           keyboard otherwise). -->
      <merge key="input.xkb.model" type="string">thinkpadintl</merge>
      <match key="/org/freedesktop/Hal/devices/"
        <merge key="input.xkb.model" type="string">evdev</merge>
      <merge key="input.xkb.layout" type="string">us</merge>
      <merge key="input.xkb.variant" type="string" />
      <merge key="input.xkb.autoRepeat" type="string">500 30</merge>
      <merge key="input.xkb.options" type="string">ctrl:nocaps,altwin:menu,compose:ralt,eurosign:e</merge>

The Touchpad configuration was a little more involving, because I added a few options which, before, I didn’t know the thing supported. 99-x11-synaptics.fdi:

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
    <match key="info.capabilities" contains="input.touchpad">
    <merge key="input.x11_driver" type="string">synaptics</merge>
    <!-- Arbitrary options can be passed to the driver using
         the input.x11_options property since xorg-server-1.5. -->
    <!-- Switch on shared memory, enables the driver to be configured at runtime -->
    <!-- This allows configuration of the touchpad using qsynaptics, synclient, or what have you -->
    <merge key="input.x11_options.SHMConfig" type="string">on</merge>
    <!-- Enable vertical scrolling by dragging your finger along the right edge -->
    <merge key="input.x11_options.VertEdgeScroll" type="string">1</merge>
    <!-- Enable horizontal scrolling by dragging your finger along the left edge -->
    <merge key="input.x11_options.HorizEdgeScroll" type="string">1</merge>
    <!-- This is a little bigger than the default narrowing the scroll region -->
    <merge key="input.x11_options.RightEdge" type="string">5500</merge>
    <!-- This is a little bigger than the default narrowing the scroll region -->
    <merge key="input.x11_options.BottomEdge" type="string">4500</merge>
    <!-- disable Right Top corner "button" -->
    <merge key="input.x11_options.RTCornerButton" type="string">0</merge>
    <!-- disable Right Bottom corner "button" -->
    <merge key="input.x11_options.RBCornerButton" type="string">0</merge>
    <!-- Enable vertical scrolling when dragging with two fingers anywhere on the touchpad -->
    <merge key="input.x11_options.VertTwoFingerScroll" type="string">1</merge>
    <!-- Enable horizontal scrolling when dragging with two fingers anywhere on the touchpad -->
    <merge key="input.x11_options.HorizTwoFingerScroll" type="string">1</merge>
    <!-- Enable tapping to emulate mouse buttons -->
    <merge key="input.x11_options.TapButton1" type="string">1</merge>
    <merge key="input.x11_options.TapButton2" type="string">2</merge>
    <merge key="input.x11_options.TapButton3" type="string">3</merge>
    <!-- Maximum movement of the finger for detecting a tap -->
    <merge key="input.x11_options.MaxTapMove" type="string">221</merge>
    <!-- For other possible options, check CONFIGURATION DETAILS in synaptics man page -->

I’m still not completely satisfied with the Touchpad configuration (actually less so than before I started messing with HAL), so I wrote a little tool to be able to mess around with my configuration a little bit easier.

Introducing synclient-sync

With SHMConfig on, you can use the synclient program to make changes to the touchpad configuration without having to restart X. I decided that it would be handy if I could utilize this to test out changes I made to the HAL config file without having to reload it, so I wrote a little script which detects the differences between the current (live) configuration and the configuration in the HAL .fdi file. The running configuration is then updated to reflect the changes in this file. (Newer versions of the script can be found on GitHub)

    cat <<EOF
Usage: $0 options
--verbosity [level] Control the level of output processed by the script.
Level 0: No output at all
Level 1: Only output changed options
Level 2: Only output options set in the configuration file
Level 3: Output all options
--verbose Shortcut for verbosity level 3
--help Show this help
    exit 1
    cat $HAL_FILE \
        | grep '<merge key="input.x11_options.' \
        | grep -v 'SHMConfig' \
        | sed -e $HAL_SED_FILTER
     synclient -l \
        | grep '=' \
        | sed -e 's/\s//g' \
        | while read option; do
key=`echo $option|cut -f 1 -d '='`
            old_val=`echo $option|cut -f 2 -d '='`
            new_val=`options_from_hal_file|grep $key|cut -f 2 -d '='`
            if [ -z $new_val ]; then
                [ $VERBOSITY_LEVEL == 3 ] && echo -e "\e[1;30m$key = $old_val\e[0m"
            elif [ $old_val != $new_val ]; then
                [ $VERBOSITY_LEVEL -ge 1 ] && echo -e "\e[1m$key = \e[1;31m$old_val \e[1;4;32m$new_val\e[0m"
                synclient "$key=$new_val"
            else # The HAL file and the life configuration are in sync
                [ $VERBOSITY_LEVEL -ge 2 ] && echo -e "\e[1m$key = \e[4m$new_val\e[0m"
while [ $# -gt 0 ]; do
case "$1" in
if [ $do_from == 1 ]; then
# vim: set shiftwidth=4 tabstop=4 expandtab: 


    1 Comment ( Add comment / trackback )

    1. On July 12, 2013 at 03:12

      re going to take a step-by-step look at how you can find and automatically install plugins directly from within Word –
      Press. Further, it helps you to change the themes and customized plug-ins without making any
      changes in the HTML or PHP coding of the website.
      To find out more about removing the author, visit this WordPress.

      my blog; wordpress developer