Page MenuHomeFreeBSD

Ports support for coming input events interface

Authored by on Aug 21 2016, 11:05 AM.


Group Reviewers
  1. Move evdev headers from v4l_compat to libevdev slave port (devel/evdev-proto) and use sed to convert evdev headers from Linux kernel to FreeBSD-compatible format, so userland software can be compiled with up to date headers automatically. Original headers are downloaded from torvalds/linux github repository.
  2. Version bumps for evdev related ports that require modern version of evdev headers

devel/libevdev 1.4.4 -> 1.5.7
devel/py-evdev 0.5.0 -> 0.7.0
devel/evemu 2.6.0 -> 2.7.0
x11/libinput 1.6.0 -> 1.8.3

  1. New ports:

devel/evdev-proto 4.13

  1. Existing evdev-related ports changed to depend on devel/evdev-proto rather then on multimedia/v4l_compat

Some related links
PR/196678 (x11-servers/xorg-server: make config/devd recognize /dev/input/eventX):

Test Plan

poudriere builds on amd64_10.1 and i386_9.3 jails

Simple way to test proposed changes w/o installing evdev-enabled kernel:

  • rebuild multimedia/v4l_compat if installed
  • install (or rebuild) x11-drivers/xf86-input-evdev (and devel/libevdev as dependency)
  • rebuild x11-servers/xorg-server and set DEVD option. No configuration required unless xorg.conf is broken already
  • restart X-server and check if your input devices attached as before and legacy part of PR/196678 patch is working
  • install (or rebuild) multimedia/webcamd with INPUT KEYBOARD and MOUSE options set
  • take a list of your usb devices with webcamd:

$ sudo webcamd -l

  • than attach webcamd to one of input devices listed e.g:

$ sudo webcamd -N USB-PS2-Optical-Mouse-Logitech -S unknown -M 0
Attached to ugen0.3[0]
Creating /dev/input/event0
If all went OK, your device should still be working but use evdev interface. You can check this in /var/log/Xorg.0.log.
Its possible to check what is transmitted via evdev interface with evemu-record utility from devel/evemu port

Diff Detail

rP FreeBSD ports repository
Lint Skipped
Unit Tests Skipped

Event Timeline retitled this revision from to Ports support for coming input events interface. updated this object. edited the test plan for this revision. (Show Details) set the repository for this revision to rP FreeBSD ports repository.

So you have a, simple if possible, way to test the above changes?

And how much of the changes in this review depend on the evdev kernel patch? Can it work without that patch?

In D7588#157689, @kwm wrote:

So you have a, simple if possible, way to test the above changes?

devel/libevdev - run internal regression tests. They depend on uinput so evdev kernel support is a must. Currently it cannot pass all tests due to lack of kernel support for some features so I commented out test section in port`s Makefile. I see no regressions as compared with previous version
devel/py-evdev 0.5.0 -> 0.6.1 - this wrapper is only compile tested
multimedia/webcamd -> (kernel evdev interface compatible version) - there is a link for ongoing testing. At least it works with my touchscreen
x11-drivers/xf86-input-evdev 2.9.2 -> 2.10.3 - works with all my hardware. No unit tests available
x11-drivers/xf86-input-synaptics 1.8.2 -> - works with my touchpad (Elantech) in evdev mode. Not tested in psm mode and with synaptics touchpads
devel/libevdev-headers - webcamd is up to date since
devel/evemu - passes internal regression tests. just run make test on port`s Makefile. Not sure if it requires uinput
x11-servers/xorg-servers - that is most invasive change. This patch works for me and previous versions works for some other testers. See PR/196678

And how much of the changes in this review depend on the evdev kernel patch?

Not many. Only some optional (and currently not used) sed scripts for patching of headers paths. Most changes can be used with webcamd too.

Can it work without that patch?

Basically it can. But this patch fixes obvious bugs in ports supplied userland evdev headers so devel/libevdev-headers part is a must for both kernel and webcamd event device implementations. Some other changes like enabling of support for event interface for x11-drivers/xf86-input-synaptics and x11-servers/xorg-servers are not strictly necessary but nice to have

In D7588#157689, @kwm wrote:

So you have a, simple if possible, way to test the above changes?

If you want to test above changes "in hardware" I can try to make webcamd patch to workaround "missing usb serial number" issue so it will be possible to attach webcamd to usb keyboards and mouses. Webcamd interface should exactly match its in-kernel counterpart since v.


What does ports-patch do ?


We try to *never* do runtime feature detection


I don't have this file on 9.3, 10.3 or 11.0, when is it present ? added inline comments.

I think that part can be reworded

  1. ports - introduces build dependence on devel/libevdev-headers port. It has more IOCTL definitions than we support but libevdev handles that at runtime
  2. base - port compiles with evdev headers from base system. sed script is provided for conversion of include paths in source files in that case
  3. ports-patch - port (currently devel/libevdev and devel/libevdev-headers) compiles with bundled evdev headers . sed script for header conversion from Linux to FreeBSD is provided in that case.

1 implies 3 for some strange software like libinput that has both bundled evdev headers and external evdev headers dependency.


Runtime feature detection is what devel/libevdev (and than all dependent ports) does. I don`t think we are going to rewrite it.


I forgot to mention in my previous answer. If would be commited than we would have at least two different event device implementation with different features - one in kernel and one Linux-derived in userspace (webcamd)


It is not commited to source tree yet. That is why the word "coming" is included in review header. See added inline comments.

Runtime feature detection is what devel/libevdev (and than all dependent ports) does. I don`t think we are going to rewrite it. updated this object. edited edge metadata.

Mk/Uses/ evdev ARGS comments reworded
multimedia/webcamd updated to edited edge metadata. edited the test plan for this revision. (Show Details) marked 2 inline comments as done and an inline comment as not done.Aug 27 2016, 12:09 PM
In D7588#157689, @kwm wrote:

So you have a, simple if possible, way to test the above changes?

TEST PLAN field updated to reflect simple way of testing

hselasky edited edge metadata.

These changes look good to me. updated this object. edited edge metadata.
  1. Remove webcamd from patch as it has been commited already
  2. libevdev 1.5.2->1.5.4
  3. Make multimedia/v4l_compat not depending on devel/libevdev-headers. Fix couple (all?) of ports to be compileable with this change. updated this object. edited edge metadata.

Copy serial line configuration black magic from xf86-input-keyboard driver to xorg-server console configuration routine.
This allows prevent interference between terminal and xorg-server screen output when xorg is configured for evdev rather than terminal keyboard input. updated this object. edited edge metadata.

Ports versions updated.
Diff rebased to current ports tree.
Not very extensively tested. updated this object. edited edge metadata.

Move sed scripts for patching evdev headers to devel/libevdev and remove Mk/Uses/
Chase for xorg-server 1.18.4 update

PR/217248 - devel/libevdev: update to 1.5.6, fix outdated and broken evdev headers ( has been created


What tests have you done?

Patches looks good to me.



What tests have you done?

Libevdev passes 100% of internal regression tests after I #ifdef-ed out unsupported ForceFeedback test. I updated PR`s patch to support tests
xf86-input-evdev, xf86-input-libinput and xf86-input-synaptics are working for a long (~1.5 year) time for me with 1.5 version of libevdev and various versions of this review.
Both in-kernel and webcamd 4.8 event devices were tested.
Other ports are only compile-tested.
I'm not completely sure that I catched all evdev clients in a port tree but I have no technical ability to analyze and compile every port. This list of ports was obtained by grepping Makefile for v4l_compat strings with following grepping of sources for input.h

mat requested changes to this revision.Feb 21 2017, 12:29 PM
mat added a reviewer: mat.
mat added inline comments.

In FreeBSD, we install the headers with the libraries, please merge this port into devel/libevdev.

This revision now requires changes to proceed.Feb 21 2017, 12:29 PM

These headers are not library interface, but a kernel one. I extract them from libevdev not from linux kernel because libevdev is main consumer, always contains updated version and have relatively small filesize.
FreeBSD have native versions of these headers located in /usr/include/dev/evdev/ but as evdev interface evolves faster than our release cycle, they have limited usage in ports system.

I suggest to change headers ports name from libevdev-headers to just evdev-headers to clear this confusion

But, mmm, if those are a kernel interface, surely our base system's kernel provides them, no ?

We do not provide some of ioctls (EVIOCGMASK & EVIOCSMASK) in kernel but

  1. There is userspace evdev implementation in ports tree (multimedia/webcamd) that handles them
  2. libevdev has some built in runtime features checks, e.g. it can query uinput protocol version (4 or 5) at runtime and choose appropriate ioctls. It currently do not have checks for EVIOC*MASK as do not wrap these services yet.
  3. libevdev usually wants recent headers to compile and tries to do #2 to work on older kernels
  4. Newer versions of headers contains newer event codes definitions that can be used with older kernels.
  5. If some software does want check supported ioctls at compile time it always possible to replace #include <linux/input.h> with #include <dev/evdev/input.h> in sources
13 ↗(On Diff #25394)

Only comment here: /dev/null might not be available inside jails. You should check for dummy_fd < 0. edited the summary of this revision. (Show Details)

Evdev headers now are downloaded from torvalds/linux github repository not from libevdev port
PR/196678 is excluded as it should be the part of future xorg-server update proposed by mrezny@. (I hope it will happen, better sooner than later)
devel/libevdev, devel/py-evdev, devel/evemu & x11/libinput versions are bumped
PR/219264 (x11/libwacom: install the profiles of tablets) is leaked into the patch, but it can be removed if necessary marked an inline comment as done.

Small fix

Looks good to me. --HPS

Most changes has been committed with r487789