Thread: K5 Xorg thoughts
View Single Post
Old 09-27-2012, 07:37 PM   #1
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.twobob ought to be getting tired of karma fortunes by now.
twobob's Avatar
Posts: 6,586
Karma: 6029447
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
Xorg thoughts


How to set up input hotplugging
Writing xorg.conf sections is not only boring, it's also quite pointless in most cases. So let's let the server find input devices automagically. The two ingredients are HAL and DBus. At startup, the server queries HAL over DBus for a list of devices and adds them one-by-one.

All you need to do is configure HAL so the server adds the devices with the right options.
You must merge the key input.x11_driver. Look at x11-input.fdi. This file should reside in /etc/hal/fdi/policy/, and it tells HAL to merge the evdev driver for each mouse and keyboard It also merges some Xkb options for keyboards.
Important: the server will not add devices unless they have input.x11_driver set. If you end up with no devices at all, then your HAL setup is probably broken.

To test your installation, run hal-device to obtain a list of all devices and look for the input.x11* keys. If they are not present, modify the fdi file and restart HAL.

Your X server is now hot-plug capable. It will add all mice and keyboards automatically, even if you add/remove them at runtime. There's modified fdi files floating around to add hotplug for wacom tablets and synaptics touchpad, finding them is left as an exercise for the reader.

What to do with the xorg.conf
We have two configuration files now. Yay. One is xorg.conf, the other one is the fdi file. And they both don't know about each other, leading to interesting results. The server parses xorg.conf first, then gets the devices through HAL. And here we have a big culprit: if add a InputDevice section with the mouse driver, it will conflict with the evdev driver. Evdev grabs the files, remember? So when all mice are added through the HAL evdev hotplugging mechanism, all mice stop sending to the /dev/input/mice file. So although you still have a valid input device in the server, it will never emit any events.
The only solution here? Either stop hotplugging alltogether by adding Option "AutoAddDevices" "off" in your ServerLayout, or modify the fdi file that it doesn't merge input.x11_driver for the specific mice you don't want hotplugged (or all mice).
On the kindle 5 we have an xorg that defines the touchscreen device so that needs to be considered also


Troubleshooting list:
I have no input devices. HAL setup needs to be configured. Make sure the x11-input.fdi file is in /etc/hal/fdi/policy, and that hal-device lists mice and keyboards with input.x11_driver = "evdev".

My xorg.conf settings are ignored. HAL adds your devices without settings, and evdev grabs all devices away. Modify the fdi and add your settings there, or add Option "AutoAddDevices" "off" to your ServerLayout. Note that this will stop input hotplugging.

I'm getting a "Grab failed" in the logs. You have two evdev input devices pointing to the same device file. This usually only happens if you have a xorg.conf entry with an evdev, and then HAL tries to add the same device again. You can ignore this warning.

I have devices in my xorg.conf but still don't get any devices. Your ServerLayout doesn't reference the input devices and your HAL setup is broken. Add Option "AllowEmptyInput" "off" to your ServerLayout or simply reference the InputDevice sections in the ServerLayout. While you're at it, you may also want to configure HAL.

My touch(pad) is slow. Check the logs if the touchpad is added with the evdev driver. If so, modify the fdi file to merge synaptics as input.x11_driver, or add a InputDevice section in your xorg.conf (must be referenced by the ServerLayout).

Evdev doesn't support option "XYZ". Add a feature request to X.Org Bug 16699. Bugs with patches get preference.
etc... this is possibly worth more thought and consideration.

FYI the file referenced is:

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
    <!-- The way this works: 
    Match against some input device (see the HAL specification for more 
    information), and then merge in keys, which you can use to specify 
    the configuration similar to the way you would in xorg.conf. You will 
    need to restart HAL after making changes. If you are having issues,
    starting X with the -logverbose 7 flag may yield useful information.
    Keys Supported:
        Key "input.x11_driver" (string)
            This specifies the driver to use. You MUST specify this option,
            or a driver will not be loaded and the rest will be ignored by
        Key "input.x11_options.<option name>" (string)
            This allows you to specify arbitrary options to pass to the driver.
            Anything you would normally specify in xorg.conf goes here. So, for
            option "Mode" in xorg.conf, you would specify the key name of

	    Do not specify "input.x11_options.Device" since "input.device"
	    will be used automatically.

            You MUST specify all options as strings, otherwise the server will
            ignore them.

        Legacy Keys
            These keys are deprecated. Use these instead:

	    See the evdev documentation for more information. 
    FIXME: Support tablets too. 
    TODO: I think its fixed, can't test
    <match key="info.capabilities" contains="input.mouse">
      <merge key="input.x11_driver" type="string">mouse</merge>
      <match key="/org/freedesktop/Hal/devices/"
        <merge key="input.x11_driver" type="string">evdev</merge>
      <match key="/org/freedesktop/Hal/devices/"
       <match key="input.device" contains="usb">
        <merge key="input.x11_options.StreamsModule" type="string">usbms</merge>
        <merge key="input.x11_options.Protocol" type="string">VUID</merge>

    <match key="info.capabilities" contains="input.keys">
      <merge key="input.x11_options.XkbRules" type="string">base</merge>

      <!-- If we're using Linux, we use evdev by default (falling back to
           kbd otherwise). -->
      <merge key="input.x11_driver" type="string">kbd</merge>
      <merge key="input.x11_options.XkbModel" type="string">pc105</merge>
      <match key="/org/freedesktop/Hal/devices/"
        <merge key="input.x11_driver" type="string">evdev</merge>
        <merge key="input.x11_options.XkbModel" type="string">evdev</merge>
      <match key="/org/freedesktop/Hal/devices/"
       <match key="input.device" contains="usb">
        <merge key="input.x11_options.StreamsModule" type="string">usbkbm</merge>
        <merge key="input.x11_options.Protocol" type="string">VUID</merge>

      <merge key="input.x11_options.XkbLayout" type="string">us</merge>

      <merge key="input.x11_options.XkbVariant" type="string" />

Obviously this isn't directly applicable as-is but perhaps there is milage in this. Perhaps it could be irrelevant. Time will tell. I'm looking for ways of ripping stuff out rather than putting it in - if you were wondering.
Will revisit when I know more. documented for the enlightened or interested reader.

Last edited by twobob; 09-27-2012 at 07:40 PM.
twobob is offline   Reply With Quote