CFT: EVDEV support in psm(4) driver
vladimir at kondratyev.su
Sun Apr 16 19:25:09 UTC 2017
Hi, FreeBSD laptop users
Following patch  bring in multitouch EVDEV support for Synaptics and
touchpads found in many laptops. (And for generic relative PS/2 mices as
This allows to replace our limited in-kernel gesture processor with
one from xf86-input-synaptics or xf86-input-libinput driver and makes
Synaptics and Elan PS/2 touchpad support to be mostly on par with Linux
Other mostly evdev-unrelated fixes and improvements are:
1. Fix rare but quite annoying issue in Elan hw v.4 touchpads support.
Triple-finger taps are reported as double-finger taps under several
2. Adjust tap min queue size on Elans to make multifinger tap detection
3. Adjust Elantech palm width threshold to nearly match synaptics
4. Discard pointer movements rather then mouse packets on palm detection
to reduce cursor jumping.
5. Enable palm detection on two finger touches for multitouch trackpads.
6. Reduce synaptics touch sensitivity
Increase hw.psm.synaptics.min_pressure default value from 16 to 32
to nearly match Linux driver (30-35 hysteresis loop).
This makes libinput tap detection more reliable.
7. Serialize atkbdc ports and psm softc access with mutexes
and mark psm interrupt and cdev handlers MPSAFE
Patch is made for 12-CURRENT and most probably can be applied to recent
11-STABLE (not tested)
How to test.
1. Apply patch 
2. Add `device evdev` and `options EVDEV_SUPPORT` to kernel config file
and rebuild kernel
3. Add hw.psm.elantech_support=1 or hw.psm.synaptics_support=1 to
4. Add kern.evdev.rcpt_mask=12 to /etc/sysctl.conf to enable psm source
and disable sysmouse
5. Install x11-drivers/xf86-input-synaptics port compiled with EVDEV
support enabled or
6. Tell XOrg to use synaptics or libinput driver as primary mouse
# Driver "libinput"
Option "Device" "/dev/input/eventXXX"
Exact value of "/dev/input/eventXXX" can be obtained with evemu-record
In most cases I have seen psm event device is located at
Lenovo trackpoint should appear as separate relative event device and is
handled with xf86-input-evdev driver (not tested yet)
Note: Neither HAL nor DEVD Xorg configuration backends support evdev at
present time so
x11-servers/xorg-server should be recompiled w/o autoconfiguration
Alternatively DEVD or UDEV backends from coming Xorg update  can be
7. Reboot and test touchpad with XOrg or evemu-record
 psm(4) evdev support: https://reviews.freebsd.org/D10207
 evemu port: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218383
Not commited yet.
 Xorg 1.19.3 update:
(Patch content is slightly garbled)
More information about the freebsd-current