New devd-based X.Org autoconfiguration backend

Vitaly Magerya vmagerya at
Sat Sep 21 11:55:01 UTC 2013

On 09/09/2013 17:52, Niclas Zeising wrote:
>> The attached patch, also available in the latest updated version at
>> updates various xorg related libraries and drivers, most of this is
>> visible for all users of xorg.
>> xorg-server now has the possibility to use devd instead of hal for
>> autoconfiguration.

And here's an update to that patch that implements a (hopefully)
better devd-based autoconfiguration backend.

Comments, questions, failure reports are welcome.

Note that this backend is only enabled if you're using WITH_NEW_XORG.
My attempts to port it to older xserver has so far been a failure
(I left a piece of code that will compile with xserver-1.5.x,
but X will fail to load drivers when my code asks it to).

== How to install it

Apply xorg-mesaupdate.diff to your ports tree, or grab the ports
tree from Xorg development repo [2] (which is what I do).

Apply the patch at [1] on top of that.

Reinstall x11-servers/xorg-server with DEVD option on.

As a first-time measure, either reboot or run "service xhotplug
start". Then (re)start X server (don't forget to remove InputDevice
sections from your xorg.conf, if you've been using static
configuration before).

== What it does

The backend will first add two devices: syscons keyboard device
and sysmouse mouse device. Then, any atp(4), joy(4), psm(4),
uep(4), uhid(4) and ums(4) devices will be added and removed
dynamically, as they appear in your system. atp, psm and ums
devices will by default use xf86-input-mouse driver; uep will
use xf86-input-egalax, if it's installed. The rest will have no
default driver.

You can change the driver, and set any needed options for any
of the devices by using InputClass section of xorg.conf (see
xorg.conf man page).

== Cooperation with moused(8)

The backend will try to play along with moused(8): if you have
moused_enable=YES (by default it's NO), or moused_nondefault_enable=YES
(by default it's YES) set in your rc.conf, moused will be given
the priority to take over psm and ums devices. The upside of
this is that you'll have mouse working in console. The downside
is that X server will only see the combined mouse device (sysmouse),
and will not be able to configure each mouse individually.

== Keyboards

While it is possible to make X server to see and configure each
keyboard individually, this backend chooses to let kbdmux(4)
take over any ukbd device that appears in your system, and only
expose X to one combined keyboard. This is so that your keyboards
would work in both X and the console. The alternative (to let
Xorg see each keyboard separately, but not to enable them in
console) seems too error prone for my taste.

== Multiple Xorg servers running at once

As discussed earlier in this thread, sharing input devices is
not really possible in FreeBSD. If multiple X servers are running
on your machine at the same time, each will try to grab every
input device, but aside from syscons and sysmouse, they will
fail, and only the first server will be able to actually use the

== Debugging hotplug

(Users are not expected to know or care about this part).

You can get a list of devices the backend tried to add by running
"service xhotplug list". Here's what it should show on a typical

    # service xhotplug list
    syscons driver=kbd device= flags=keyboard name=System%20Keyboard product=syscons
    sysmouse driver=mouse flags=pointer name=System%20Mouse product=sysmouse
    psm0 driver=mouse flags=pointer name=PS%2f2%20Mouse   

You can remove any device like this:

    # service xhotplug remove psm0

... and add it back, with different options:

    # service xhotplug add psm0 Emulate3Buttons=OFF

To verify that X actually has all the devices you think it should
have, you can use x11/xinput utility:

    # xinput
    ⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
    ⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
    ⎜   ↳ System Mouse                            	id=7	[slave  pointer  (2)]
    ⎜   ↳ PS/2 Mouse                              	id=8	[slave  pointer  (2)]
    ⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
        ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
        ↳ System Keyboard                         	id=6	[slave  keyboard (3)]


More information about the freebsd-x11 mailing list