Bug 222609 - x11-servers/xorg-server: Add UDEV option to support evdev devices autodetection
Summary: x11-servers/xorg-server: Add UDEV option to support evdev devices autodetection
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-x11 (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-09-25 22:13 UTC by Val Packett
Modified: 2020-02-25 09:27 UTC (History)
16 users (show)

See Also:
jbeich: maintainer-feedback-


Attachments
xorg-server-udev.patch (1.43 KB, patch)
2017-09-25 22:13 UTC, Val Packett
no flags Details | Diff
xorg log (13.45 KB, text/x-log)
2017-10-12 10:30 UTC, Ivan
no flags Details
device list (2.23 KB, text/x-log)
2017-10-12 10:32 UTC, Ivan
no flags Details
boot log (6.15 KB, text/x-log)
2017-10-16 07:24 UTC, Ivan
no flags Details
evdev desc (3.41 KB, text/x-log)
2017-10-16 07:24 UTC, Ivan
no flags Details
fix-synaptics-resolution.patch (569 bytes, patch)
2017-10-16 22:35 UTC, Vladimir Kondratyev
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Val Packett 2017-09-25 22:13:48 UTC
Created attachment 186724 [details]
xorg-server-udev.patch

This patch allows Xorg to be built with libudev-devd support, which allows automatic detection of /dev/input/* (evdev) devices, supported by xf86-input-libinput or xf86-input-evdev.
Comment 1 Jean-Sébastien Pédron freebsd_committer freebsd_triage 2017-10-04 22:40:18 UTC
Hi!

I tried your patch + drm-next and it's working quite nicely!

I used xf86-input-libinput to drive a Synaptics touchpad (Thinkpad T440p) and an external USB mouse, and xf86-input-evdev to drive the internal keyboard of the laptop and an external USB keyboard.

I couldn't get the keyboard to work with xf86-input-libinput, even though correct events are reported by libinput-debug-events(1). With xf86-input-evdev, it looks ok, though with the internal keyboard, the "less than/greater than" key doesn't emit any event. I didn't check if the same issue exists with the external keyboard. They are a few other bugs with the touchpad as well, but it's still better than without libinput.

I don't know if it was necessary, but I added InputClass blocks to ignore other devices, like duplicates (/dev/{psm,sysmouse,atkbd,kbdmux}* vs /dev/event/*).
Comment 2 Val Packett 2017-10-04 23:19:35 UTC
(In reply to Jean-Sébastien Pédron from comment #1)
It's not necessary, libudev-devd only discovers /dev/input/event* devices.
Comment 3 Vladimir Kondratyev freebsd_committer freebsd_triage 2017-10-04 23:46:51 UTC
(In reply to Greg V from comment #0)
Slightly enhanced version of this patch was to included into XOrg update to version 1.19.3 but it has not hit ports tree yet for unknown reasons:
https://lists.freebsd.org/pipermail/freebsd-x11/2017-March/019100.html
Comment 4 Val Packett 2017-10-04 23:56:13 UTC
(In reply to Vladimir Kondratyev from comment #3)
Hmm! "The devd config backend has been updated to handle /dev/hidX and 
/dev/input/eventX devices as provided by webcamd" — I wonder how *that* interacts with evdev devices from the kernel and handling duplicates in that case…
Comment 5 Vladimir Kondratyev freebsd_committer freebsd_triage 2017-10-04 23:57:35 UTC
(In reply to Jean-Sébastien Pédron from comment #1)
> I couldn't get the keyboard to work with xf86-input-libinput

IIRC, libinput requires "xkb_rules" set to "evdev" explicitly

Try to add lines below to your xorg.conf after this patch has been applied:
Section "InputClass"
       Identifier              "Evdev keyboard XkbRules"
       MatchDevicePath         "/dev/input/event*"
       MatchIsKeyboard         "on"
       Option                  "XkbRules" "evdev"
EndSection
Comment 6 Vladimir Kondratyev freebsd_committer freebsd_triage 2017-10-05 00:13:16 UTC
(In reply to Greg V from comment #4)
> I wonder how *that* interacts with evdev devices from the kernel and handling duplicates in that case
webcamd inter-operates with inkernel evdev-capable drivers almost perfectly. It just disables kernel driver at attach (but not restores it at detach). It has support for free /dev/input/* character device units detection and has the same API.
Comment 7 Vladimir Kondratyev freebsd_committer freebsd_triage 2017-10-05 00:31:13 UTC
(In reply to Vladimir Kondratyev from comment #3)
> Slightly enhanced version of this patch was to included into XOrg update to version 1.19.3
I should mention that 1.19.3 update patches are made for kernel compiled w/o option EVDEV_SUPPORT. They require some additional work to properly handle kernels compiled with this option enabled.
Comment 8 Ivan 2017-10-05 19:59:23 UTC
Do we need CURRENT for testing ? I'm not sure I have /dev/input on my laptop with 11.1-RELEASE generic kernel.
Comment 9 Val Packett 2017-10-05 20:02:56 UTC
(In reply to Ivan from comment #8)
I think some evdev stuff might have landed in 11, but you need to recompile your kernel with 'device evdev' and 'options EVDEV_SUPPORT'. (Or kldload evdev instead of compiling in the device I guess??)
Comment 10 Ivan 2017-10-12 09:09:46 UTC
kldload evdev doesn't bring /dev/input node up for me, but custom kernel is.
Proceeding to test now. :)
How can I discover what device every eventX represents?
Comment 11 Val Packett 2017-10-12 10:05:26 UTC
(In reply to Ivan from comment #10)
Yeah, you need EVDEV_SUPPORT to enable the evdev support in the actual drivers (ums, ukbd, psm, etc.)

Use libinput-list-devices to list devices
Comment 12 Ivan 2017-10-12 10:29:46 UTC
I see echo from keys I pressing. It starts from the left top and proceeds to right bottom, as if I write text with editor. When I hit enter here, echo makes CR as well.
I use libinput driver.

Also, I've noticed that arrow keys are not working (but emitting something as echo)

Synaptics touchpad in not working as well.
Comment 13 Ivan 2017-10-12 10:30:39 UTC
Created attachment 187100 [details]
xorg log
Comment 14 Val Packett 2017-10-12 10:32:30 UTC
(In reply to Ivan from comment #12)
Make sure you have kern.evdev.rcpt_mask=12 to get events from psm/ums/ukbd instead of sysmouse/kbdmux.

For arrow keys, make sure you have the evdev XKB ruleset (setxkbmap -rules evdev).
Comment 15 Ivan 2017-10-12 10:32:41 UTC
Created attachment 187101 [details]
device list
Comment 16 Ivan 2017-10-12 10:49:35 UTC
I set sysctl option and evdev rules. Arrow keys are fixed now.
Touchpad is not working. I have /dev/psm0 and hw.psm.synaptics_support=1 in loader.conf
And, echoing input is a show breaker.
Comment 17 Val Packett 2017-10-12 10:57:48 UTC
(In reply to Ivan from comment #16)
Synaptics works for me… You don't even have the /dev/input device for it, that's weird. If you built your kernel with EVDEV_SUPPORT, psm should create an evdev device.

I don't understand what you mean by "echo"…
Comment 18 Ivan 2017-10-12 11:23:26 UTC
http://i.imgur.com/YzxZ225.png
When I type something, I see phantom output. It reflects all my actions, like console under by X11 session. I never see this effect before with legacy xf86-input drivers.
Comment 19 Ivan 2017-10-12 11:29:44 UTC
Phantom output is pure graphical glitch, so it doesn't interfere with actual keystrokes, like if libinput send keystrokes into 2 destinations.
Comment 20 Vladimir Kondratyev freebsd_committer freebsd_triage 2017-10-12 23:15:37 UTC
(In reply to Ivan from comment #19)
> I see phantom output.
It is known issue. Try https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220562
Comment 21 Ivan 2017-10-13 12:18:27 UTC
Thanks! I've used wrong words googling the matter. Now libinput works perfectly. As for synaptics touchpad, evdev support for psm devices is not merged into 11.1-RELENG.
Comment 22 Ivan 2017-10-15 12:48:14 UTC
Probably, I'm doing it wrong to use this bug for support, feel free to point me to right direction, but I can't get node for synaptics touchpad on STABLE and according commits, this code is already in. https://reviews.freebsd.org/D10265

1. FreeBSD 11.1-STABLE #1 r324623: Sun Oct 15 15:10:17 MSK 2017
2. Custom kernel with 
device evdev
options EVDEV_SUPPORT
3. hw.psm.synaptics_support=1 in /boot/loader.conf
4. kern.evdev.rcpt_mask=12 in /etc/sysctl.conf

I don't see touchpad under /dev/input , and /dev/input/event3 is missing in libinput-list-devices.

 ls /dev/input/
event0 event1 event2 event3 event4 event5 

When I run libinput-list-devices, event3 is skipped, the following warning is printed

# libinput-list-devices
libinput error: kernel bug: Kernel has only x or y resolution, not both.

Here is bits from /var/log/messages
Oct 15 15:28:27 sphinx kernel: psm0: <PS/2 Mouse> irq 12 on atkbdc0
Oct 15 15:28:27 sphinx kernel: psm0: [GIANT-LOCKED]
Oct 15 15:28:27 sphinx kernel: psm0: model Synaptics Touchpad, device ID 3
Comment 23 Ivan 2017-10-15 12:57:38 UTC
abishai@sphinx:~ % sysctl -a | grep synaptics
hw.psm.synaptics.softbutton3_x: 3900
hw.psm.synaptics.softbutton2_x: 3100
hw.psm.synaptics.softbuttons_y: 1700
hw.psm.synaptics.touchpad_off: 0
hw.psm.synaptics.vscroll_div_max: 150
hw.psm.synaptics.vscroll_div_min: 100
hw.psm.synaptics.vscroll_min_delta: 50
hw.psm.synaptics.vscroll_ver_area: -600
hw.psm.synaptics.vscroll_hor_area: 0
hw.psm.synaptics.taphold_timeout: 125000
hw.psm.synaptics.tap_min_queue: 2
hw.psm.synaptics.tap_max_delta: 80
hw.psm.synaptics.div_len: 100
hw.psm.synaptics.div_max_na: 30
hw.psm.synaptics.div_max: 17
hw.psm.synaptics.div_min: 9
hw.psm.synaptics.weight_len_squared: 2000
hw.psm.synaptics.weight_previous_na: 20
hw.psm.synaptics.weight_previous: 6
hw.psm.synaptics.weight_current: 3
hw.psm.synaptics.multiplicator: 10000
hw.psm.synaptics.window_max: 10
hw.psm.synaptics.window_min: 4
hw.psm.synaptics.na_left: 1600
hw.psm.synaptics.na_bottom: 1408
hw.psm.synaptics.na_right: 563
hw.psm.synaptics.na_top: 1783
hw.psm.synaptics.margin_left: 200
hw.psm.synaptics.margin_bottom: 200
hw.psm.synaptics.margin_right: 200
hw.psm.synaptics.margin_top: 200
hw.psm.synaptics.max_width: 10
hw.psm.synaptics.max_pressure: 220
hw.psm.synaptics.min_pressure: 32
hw.psm.synaptics.two_finger_scroll: 1
hw.psm.synaptics.max_y: 6143
hw.psm.synaptics.max_x: 6143
hw.psm.synaptics.directional_scrolls: 0
hw.psm.synaptics_support: 1

sysctls for synaptics. Looks like libinput rejecting this touchpad
Comment 24 Ivan 2017-10-15 13:03:48 UTC
And Xorg logs
[    19.170] (II) config/udev: Adding input device SynPS/2 Synaptics TouchPad (/dev/input/event3)
[    19.170] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "libinput pointer catchall"
[    19.170] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "libinput touchpad catchall"
[    19.170] (II) Using input driver 'libinput' for 'SynPS/2 Synaptics TouchPad'
[    19.170] (**) SynPS/2 Synaptics TouchPad: always reports core events
[    19.170] (**) Option "Device" "/dev/input/event3"
[    19.170] (**) Option "_source" "server/udev"
[    19.382] (II) input device 'SynPS/2 Synaptics TouchPad', /dev/input/event3 is tagged by udev as: Mouse Touchpad
[    19.382] (EE) kernel bug: Kernel has only x or y resolution, not both.
[    19.382] (II) input device 'SynPS/2 Synaptics TouchPad', /dev/input/event3 was rejected.
[    19.417] (II) not using input device '/dev/input/event3'.
[    19.417] (EE) libinput: SynPS/2 Synaptics TouchPad: Failed to create a device for /dev/input/event3
[    19.417] (EE) PreInit returned 2 for "SynPS/2 Synaptics TouchPad"
[    19.417] (II) UnloadModule: "libinput"


So, event3 is created for touchpad, but it's rejected.
https://github.com/wayland-project/libinput/blob/master/src/evdev.c#L1437
Comment 25 Vladimir Kondratyev freebsd_committer freebsd_triage 2017-10-15 21:26:31 UTC
(In reply to Ivan from comment #23)
All these sysctls has no meaning for evdev except
> hw.psm.synaptics.min_pressure: 32
Comment 26 Vladimir Kondratyev freebsd_committer freebsd_triage 2017-10-15 21:36:20 UTC
(In reply to Ivan from comment #24)
> [    19.382] (EE) kernel bug: Kernel has only x or y resolution, not both.
Very strange...

Could you:
1. Place debug.psm.loglevel=5 in to /boot/loader.conf and post here a part of boot log from "synaptics: BEGIN init" to "synaptics: END init"
2. Install devel/evemu and run evemu-describe or evemu-record on your touchpad /dev/input/eventN device node
Comment 27 Ivan 2017-10-16 07:24:03 UTC
Created attachment 187207 [details]
boot log
Comment 28 Ivan 2017-10-16 07:24:38 UTC
Created attachment 187208 [details]
evdev desc
Comment 29 Ivan 2017-10-16 07:33:42 UTC
I have the following device hint  hint.psm.0.flags="0x24" It left since I tried if psm flags can help me somehow. 
If it's interfering with logs attached I can repeat without it.
Comment 30 Vladimir Kondratyev freebsd_committer freebsd_triage 2017-10-16 09:29:43 UTC
(In reply to Ivan from comment #29)
> If it's interfering with logs attached I can repeat without it.
No need. I`ll post fix here after getting access to my laptop with synaptics touchpad.
Comment 31 Vladimir Kondratyev freebsd_committer freebsd_triage 2017-10-16 22:35:50 UTC
Created attachment 187227 [details]
fix-synaptics-resolution.patch

The patch does some extra sanity checks to avoid "only one axis has resolution" libinput issue
Comment 32 Ivan 2017-10-17 07:31:10 UTC
Thank you!
I hope resolution values are not needed elsewhere.

Touchpad works, I added some hints for better usability

Section "InputClass"
    Identifier "touchpad"
    MatchIsTouchpad "on"
    Option "TransformationMatrix" "1 0 0 0 1 0 0 0 0.7"
    Option "Tapping" "on"
    Option "ScrollMethod" "edge"
EndSection

TransformationMatrix boosts speed slightly. I was unable to adjust it in xfce configuration.

[  3691.584] (II) config/udev: Adding input device SynPS/2 Synaptics TouchPad (/dev/input/event3)
[  3691.584] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "libinput pointer catchall"
[  3691.584] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "libinput touchpad catchall"
[  3691.584] (**) SynPS/2 Synaptics TouchPad: Applying InputClass "touchpad"
[  3691.584] (II) Using input driver 'libinput' for 'SynPS/2 Synaptics TouchPad'
[  3691.584] (**) SynPS/2 Synaptics TouchPad: always reports core events
[  3691.584] (**) Option "Device" "/dev/input/event3"
[  3691.584] (**) Option "_source" "server/udev"
[  3691.799] (II) input device 'SynPS/2 Synaptics TouchPad', /dev/input/event3 is tagged by udev as: Mouse Touchpad
[  3691.799] (II) SynPS/2 Synaptics TouchPad: no resolution or size hints, assuming a size of 69x50mm
[  3691.799] (II) input device 'SynPS/2 Synaptics TouchPad', /dev/input/event3 is a touchpad
[  3691.834] (**) Option "Tapping" "on"
[  3691.834] (**) Option "ScrollMethod" "edge"
[  3691.834] (**) Option "config_info" "udev:/dev/input/event3"
[  3691.834] (II) XINPUT: Adding extended input device "SynPS/2 Synaptics TouchPad" (type: TOUCHPAD, id 9)
[  3691.834] (**) Option "AccelerationScheme" "none"
[  3691.834] (**) SynPS/2 Synaptics TouchPad: (accel) selected scheme none/0
[  3691.834] (**) SynPS/2 Synaptics TouchPad: (accel) acceleration factor: 2.000
[  3691.834] (**) SynPS/2 Synaptics TouchPad: (accel) acceleration threshold: 4
[  3691.834] (**) Option "TransformationMatrix" "1 0 0 0 1 0 0 0 0.7"
[  3692.054] (II) input device 'SynPS/2 Synaptics TouchPad', /dev/input/event3 is tagged by udev as: Mouse Touchpad
[  3692.054] (II) SynPS/2 Synaptics TouchPad: no resolution or size hints, assuming a size of 69x50mm
[  3692.054] (II) input device 'SynPS/2 Synaptics TouchPad', /dev/input/event3 is a touchpad
Comment 33 commit-hook freebsd_committer freebsd_triage 2017-11-01 09:19:35 UTC
A commit references this bug:

Author: dumbbell
Date: Wed Nov  1 09:18:41 UTC 2017
New revision: 325269
URL: https://svnweb.freebsd.org/changeset/base/325269

Log:
  evdev: Translate KEY_102ND in evdev_scancode2key()

  This is the extra key on 102/105-keys keyboards, located on the right
  of the Left Shift key. For instance on a French layout, this is the '<'
  key.

  This fixes an issue where the key fires no evdev event and thus remains
  inactive in an evdev/libinput-enabled X.Org server. The issue only
  occurred on an AT keyboard; the same key on a USB keyboard worked fine.

  PR:		222609 (only for reference)
  Approved by:	wulf@
  Differential Revision:	https://reviews.freebsd.org/D12883

Changes:
  head/sys/dev/evdev/evdev_utils.c
Comment 34 Kirill Ponomarev freebsd_committer freebsd_triage 2018-04-29 19:51:53 UTC
Is it possible to commit UDEV support soon?
Comment 35 Guido Kollerie 2019-05-28 06:08:53 UTC
(In reply to Kirill Ponomarev from comment #34)

I tested the xorg-server-udev.patch (without any of the other patches attached to this bug) on FreeBSD 12-stable as I struggled to get the touchpad on my Thinkpad T480 configured properly by any other means. Seems to work beautifully. Is there anything I can help with (testing wise) to get UDEV committed soon?
Comment 36 Guido Kollerie 2019-06-17 06:37:18 UTC
(In reply to Guido Kollerie from comment #35)

With the xorg-server-udev.patch applied, the keyboard shorts for switching virtual consoles becomes Alt-F[1-8] instead of the expected Ctlt-Alt-F[1-8].

Hence I've reverted to the regular, unpatched xorg-server for now. Which is a pitty, as the out-of-the-box experience for touchpads is so much better with evdev/libinput. Not only is the touchpad usable by default with evdev/libinput, desktop environments such as Mate, recognize the touchpad as being a touchpad and provide a separate Touchpad tab in Mouse Settings.

Anyway, still willing to help with testing.
Comment 37 commit-hook freebsd_committer freebsd_triage 2020-01-25 16:27:44 UTC
A commit references this bug:

Author: jbeich
Date: Sat Jan 25 16:26:43 UTC 2020
New revision: 524048
URL: https://svnweb.freebsd.org/changeset/ports/524048

Log:
  x11-servers/xorg-server: expose UDEV support for evdev hotplug

  UDEV builds Xorg against libudev-devd, allowing automatic detection of
  /dev/input/* (evdev) devices with xf86-input-libinput or xf86-input-evdev.

  PR:		222609
  Submitted by:	Greg V <greg@unrelenting.technology>
  Tested by:	Ivan <bsd@abinet.ru>, manu
  Approved by:	x11 (bapt via IRC)

Changes:
  head/x11-servers/xephyr/Makefile
  head/x11-servers/xorg-dmx/Makefile
  head/x11-servers/xorg-nestserver/Makefile
  head/x11-servers/xorg-server/Makefile
  head/x11-servers/xorg-server/pkg-plist
  head/x11-servers/xorg-vfbserver/Makefile
  head/x11-servers/xwayland/Makefile
Comment 38 Jan Beich freebsd_committer freebsd_triage 2020-01-25 16:43:49 UTC
(In reply to Guido Kollerie from comment #36)
> With the xorg-server-udev.patch applied, the keyboard shorts for switching 
> virtual consoles becomes Alt-F[1-8] instead of the expected Ctlt-Alt-F[1-8].

Likely AutoAddDevices failed or disabled, leaving console driver (syscons or vt) in charge of handling console switching. Debugging clues should be in your xorg.conf and Xorg.0.log.
Comment 39 Ulrich Spörlein freebsd_committer freebsd_triage 2020-02-17 18:18:41 UTC
Folks, how can I debug this not really working for me? Here's what I did:

Build xorg-server with UDEV on a STABLE-12 system. GENERIC kernel (which has all required knobs, right?)

/etc/sysctl.conf has
kern.evdev.rcpt_mask=12

And I have no xorg.conf, moused is disabled also. Dbus is running and I'm using slim.

On my Thinkpad T490 the trackpoint works, and the keyboard works _somewhat_, except that:
- left win key says NoSymbol in xev
- AltGr comes up as KP_Enter
- PrtSc is Delete
- right Ctrl is Next
- PgUp is KP_Divide
- Home is Pause
- End is Super_L
- etc. pp. layout is US English of course. WAT?

and the touchpad is not doing anything, of course.


% DISPLAY=unix:0.0 libinput list-devices|grep -v "n/a|none|disabled"
Device:           System mouse
Kernel:           /dev/input/event0
Group:            1
Seat:             seat0, default
Capabilities:     pointer
Scroll methods:   button
Accel profiles:   flat *adaptive

Device:           System keyboard multiplexer
Kernel:           /dev/input/event1
Group:            2
Seat:             seat0, default
Capabilities:     keyboard

Device:           AT keyboard
Kernel:           /dev/input/event2
Group:            3
Seat:             seat0, default
Capabilities:     keyboard

Device:           SynPS/2 Synaptics TouchPad
Kernel:           /dev/input/event3
Group:            4
Seat:             seat0, default
Size:             70x50mm
Capabilities:     pointer gesture
Tap-and-drag:     enabled
Scroll methods:   *two-finger edge
Click methods:    *button-areas clickfinger
Disable-w-typing: enabled

Device:           Generic PS/2 mouse
Kernel:           /dev/input/event4
Group:            5
Seat:             seat0, default
Capabilities:     pointer
Scroll methods:   *button
Accel profiles:   flat *adaptive
Comment 40 Michael Gmelin freebsd_committer freebsd_triage 2020-02-17 18:37:37 UTC
(In reply to Ulrich Spoerlein from comment #39)

Check https://blog.grem.de/pages/t470s.html, especially:
"Configure input devices for X.org", where
/usr/local/etc/X11/xorg.conf.d/99-myinput.conf is created.

Make sure you don't have any x11 configuration besides this (no /etc/X11/xorg.conf, no /usr/local/etc/X11/xorg.conf).

You might also issue:
setxkbmap -model pc105 -layout en
and see if it makes a difference.
Comment 41 Michael Gmelin freebsd_committer freebsd_triage 2020-02-17 18:41:02 UTC
(In reply to Michael Gmelin from comment #40)

Also, check "Enable synaptics support in /boot/loader.conf" in the t470s howto (*should* be the same on your model).
Comment 42 Ulrich Spörlein freebsd_committer freebsd_triage 2020-02-17 20:19:12 UTC
THANK YOU!

I had the loader.conf already, so the only thing I added was this from your tutorial. Too bad that this isn't properly autoconfigured, but oh well.

cat >/usr/local/etc/X11/xorg.conf.d/99-myinput.conf <<EOF
Section "InputClass"
  Identifier "libinput keyboard catchall"
  MatchIsKeyboard "on"
  MatchDevicePath "/dev/input/event*"
  Driver "libinput"
  Option "XkbRules" "evdev"
EndSection

Section "InputClass"
  Identifier "libinput touchpad catchall"
  MatchIsTouchpad "on"
  MatchDevicePath "/dev/input/event*"
  Driver "libinput"
  Option "MiddleEmulation" "on"
  Option "DisableWhileTyping" "off"
EndSection
EOF

I still have to fiddle with sensitivity and accel of the touchpad, as it's quite slow, but I can work with this. Finally I have 2 finger vertical scrolling that works and isn't all choppy and useless (sorry, moused(8)).
Comment 43 Vladimir Druzenko freebsd_committer freebsd_triage 2020-02-21 00:03:23 UTC
Do this feature support non-default USB rate for mouse?
500 or 1000Hz, like moused_flags="-F 1000" in rc.conf.
Comment 44 Manuel Stühn 2020-02-24 22:15:31 UTC
The evdev-solution does only work on my Lenovo T450 Thinkpad (12.1p2) when i use the xf86-video-intel driver! With modesetting running (which i've been successfully using for over a year now), the desktop (openbox) starts, but after several seconds it will freeze and I'm only able to move mouse cursor. I'm able to ssh into the machine and restart X. All applications I've starting via openbox-autostart are actually started(checked with ps via ssh), but they do not appear on the screen! 

P.S.
I'm using pkg only, no ports.
Comment 45 Michael Gmelin freebsd_committer freebsd_triage 2020-02-24 22:26:11 UTC
(In reply to Manuel Stühn from comment #44)

Could you try running https://github.com/grembo/xorg-udev-setup-check

Direct link:
https://raw.githubusercontent.com/grembo/xorg-udev-setup-check/master/xorg-udev-setup-check.sh

to see if there is a known configuration problem?
Comment 46 Manuel Stühn 2020-02-25 05:44:14 UTC
(In reply to Michael Gmelin from comment #45)
The script you've proposed shows one error (not having drm-kmod installed, but do in fact have drm-fbsd12.0-drm installed). After omitting this test, the check finished without errors.

It seems, that the xorg-server does not work with modesetting anymore. The keyboard and mouse do kinda work. I'm able to get to the console via ALT-Ctrl-F1-F8. Also the mouse cursor is moving. But the x-server does not show anything. No application appears, although they are running, which i can see via ps.

I'd like to use modsetting again, because it has a significant lower power-footprint (intel-driver: ~8000mW <-> modsetting ~4800mW).
Comment 47 Manuel Stühn 2020-02-25 07:31:00 UTC
Sorry for the noise! My problem has nothing to do with udev/evdev, but with OpenGL and glamour. I've found https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244306 which describes my problem and provides an solution!
Comment 48 Emmanuel Vadot freebsd_committer freebsd_triage 2020-02-25 07:34:20 UTC
(In reply to Manuel Stühn from comment #47)

What's your hardware ? (pciconf -l will help)
Thanks
Comment 49 Manuel Stühn 2020-02-25 09:27:14 UTC
(In reply to Emmanuel Vadot from comment #48)
I'm using a Lenovo Thinkpad T450, touchpad disabled in BIOS.
# pciconf -lv | grep -e @ -e vendor -e device                                                                                                                         
hostb0@pci0:0:0:0:	class=0x060000 card=0x503417aa chip=0x16048086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Broadwell-U Host Bridge -OPI'
vgapci0@pci0:0:2:0:	class=0x030000 card=0x503417aa chip=0x16168086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'HD Graphics 5500'
hdac0@pci0:0:3:0:	class=0x040300 card=0x503417aa chip=0x160c8086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Broadwell-U Audio Controller'
xhci0@pci0:0:20:0:	class=0x0c0330 card=0x503417aa chip=0x9cb18086 rev=0x03 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Wildcat Point-LP USB xHCI Controller'
none0@pci0:0:22:0:	class=0x078000 card=0x503417aa chip=0x9cba8086 rev=0x03 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Wildcat Point-LP MEI Controller'
em0@pci0:0:25:0:	class=0x020000 card=0x222617aa chip=0x15a28086 rev=0x03 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Ethernet Connection (3) I218-LM'
hdac1@pci0:0:27:0:	class=0x040300 card=0x503417aa chip=0x9ca08086 rev=0x03 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Wildcat Point-LP High Definition Audio Controller'
pcib1@pci0:0:28:0:	class=0x060400 card=0x503417aa chip=0x9c9a8086 rev=0xe3 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'Wildcat Point-LP PCI Express Root Port'
pcib2@pci0:0:28:1:	class=0x060400 card=0x503417aa chip=0x9c948086 rev=0xe3 hdr=0x01
    vendor     = 'Intel Corporation'
    device     = 'Wildcat Point-LP PCI Express Root Port'
ehci0@pci0:0:29:0:	class=0x0c0320 card=0x503417aa chip=0x9ca68086 rev=0x03 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Wildcat Point-LP USB EHCI Controller'
isab0@pci0:0:31:0:	class=0x060100 card=0x503417aa chip=0x9cc38086 rev=0x03 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Wildcat Point-LP LPC Controller'
ahci0@pci0:0:31:2:	class=0x010601 card=0x503417aa chip=0x9c838086 rev=0x03 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Wildcat Point-LP SATA Controller [AHCI Mode]'
none1@pci0:0:31:3:	class=0x0c0500 card=0x503417aa chip=0x9ca28086 rev=0x03 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Wildcat Point-LP SMBus Controller'
none2@pci0:0:31:6:	class=0x118000 card=0x503417aa chip=0x9ca48086 rev=0x03 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Wildcat Point-LP Thermal Management Controller'
none3@pci0:2:0:0:	class=0xff0000 card=0x503417aa chip=0x522710ec rev=0x01 hdr=0x00
    vendor     = 'Realtek Semiconductor Co., Ltd.'
    device     = 'RTS5227 PCI Express Card Reader'
iwm0@pci0:3:0:0:	class=0x028000 card=0x52108086 chip=0x095b8086 rev=0x59 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Wireless 7265'

Everything but the middle mouse button of the trackpoint (which i use quite often!) works so far with the patch of issue #244306 applied. I have no idea how to reactivate middle mouse button. I do not need any fancy functions like scrolling, just plain old "paste" and stuff.