CFT: EVDEV support in psm(4) driver

Vladimir Kondratyev vladimir at
Sun Apr 16 19:25:09 UTC 2017

Hi, FreeBSD laptop users

Following patch [1] bring in multitouch EVDEV support for Synaptics and 
Elan PS/2
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 
more reliable.
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 [1]
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 

Section "InputDevice"
     Identifier  "Mouse0"
     Driver      "synaptics"
#   Driver      "libinput"
     Option      "Device" "/dev/input/eventXXX"

Exact value of "/dev/input/eventXXX" can be obtained with evemu-record 
utiliy [2].
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 [3] can be 
7. Reboot and test touchpad with XOrg or evemu-record

[1] psm(4) evdev support:
     Raw diff:
[2] evemu port: 
  Not commited yet.
[3] Xorg 1.19.3 update: 
(Patch content is slightly garbled)

Vladimir Kondratyev

More information about the freebsd-current mailing list