Page MenuHomeFreeBSD

x11-servers/xorg-server: Xorg devd device discovery with evdev

Authored by zeising on Feb 9 2017, 2:06 PM.


Group Reviewers

Adds discovery support for xf86-input-evdev devices.


Evdev is a generic input device driver that more or less figures out on its own what kind of device it is attached to. It can be used to drive devices that don't have a native kernel driver but are supported by webcamd.

E.g. my multitouch screen (eGalax Inc. eGalaxTouch EXC7910-1057-13.00.00), not supported by the uep driver, runs fine with webcamd.

So far I require the following Xorg configuration to use the device:

Section "Module"
	Load "evdev"

Section "ServerLayout"
	Identifier  "server0"
	InputDevice "touch0"

Section "InputDevice"
	Identifier "touch0"
	Driver     "evdev"
	Option     "Device"          "/dev/input/event0"

Attaching the device while X is runnig is not possible like this. Note that evdev figures out the right thing to do with a device on its own.

Issues Addressed

The two problems addressed by the patch are:

  • Discovery of /dev/input/eventX devices during Xorg start
  • Attach/Detach of /dev/input/eventX device during Xorg runtime


To enable startup discovery a new evdev_exists() function is introduced that tests for existing device nodes. This avoids the use of sysctl_exists(), because devices created by webcamd do not show up in sysctl.

To enable runtime discovery the wakeup_handler() is patched to recognise type=CREATE/DESTROY cdev=DEVICE events from the devd socket. The previous check for lines starting with + or - only catches a limited range of devices (excluding /dev/input/eventX).

Test Plan

Tested with xorg-server-1.18.4,1 on stable/11 amd64.

Works for me.

Diff Detail

Lint Skipped
Unit Tests Skipped

Event Timeline

kami retitled this revision from to x11-servers/xorg-server: Xorg devd device discovery with evdev.
kami updated this object.
kami edited the test plan for this revision. (Show Details)
kami added a reviewer: x11.
kami added a project: x11.


This patch is a duplicate of:

Have you tried the solution mentioned in the PR above?



This patch is a duplicate of:

Have you tried the solution mentioned in the PR above?

I haven't seen or tried this. It appears that the scope of the PR is far wider that my humble change here.

I assume you are addressing more issues with your patch.

I also suspect the broad scope of what you are doing is the reason it is not part of the latest Xorg CfT, despite it being around for over a year.

Yes, I suggest you try the latest patch in PR196678 . Yes, your patch is simple, but the matter is a bit more deeper than this :-)

I believe this patch has been superseeded by the update of xserver to 1.20.

zeising abandoned this revision.
zeising added a reviewer: kami.

Abandoning this, since these changes should be superseded by the update of xserver to 1.20.