[Patch] Sync psm/evdev/atkbd with FreeBSD - please test

Michael Neumann mneumann at ntecs.de
Wed Apr 10 01:41:30 PDT 2024


Hi all,

The last couple of days, I worked on syncing our psm/evdev and atkbd
code  (partially) with FreeBSD head. The result should be better input
device support (Touchpad etc.) on some Laptops.

The full patch is here:

https://leaf.dragonflybsd.org/~mneumann/0001-Sync-psm-evdev-atkbd-with-FreeBSD.patch

The full list of commits can be seen here:

https://github.com/mneumann/DragonFlyBSD/tree/sync-psm-evdev-atkbd-with-freebsd

I am currently testing this on an old Panasonic CF-SV laptop that I
bought in Japan, and plan to also test it on a Tuxdeo laptop, where I
really had issues with the psm driver, which regularily got out of sync.
This issue should now be fixed, as it is likely to be related to active
AUX port multiplexing. Feel free to test this patch as well and report
back potentially issues. If there are no objections, I'd like to merge
it within the next few weeks.

To summarize some of the changes:

* This (partially) syncs psm/atkbd/evdev with FreeBSD.

* Mostly psm and evdev (w/o uinput) is synced with FreeBSD.

* As for atkbd, only parts related to support active AUX port
  multiplexer code is synced from FreeBSD. Active AUX port
  MUX is required to detect for example my synaptics touchpad
  on the Pansonic CF-SV, otherwise the touchpad is only recognized
  as standard PS/2 mouse. Other laptops use the same "method" to
  attach "multiple" mice to the AUX port.

* Adds kern.features sysctl. Xorg uses e.g. kern.features.evdev
  and kern.features.evdev_support to detect if evdev is available.
  Alternative is to patch the port. This could be done in

  x11-servers/xorg-server/dragonfly/patch-config_udev.c

  by adding sth like:

	if (strcmp(feature, "evdev") == 0)
		return (1);
	if (strcmp(feature, "evdev_support") == 0)
		return (1);

  to the feature_present(const char*) function.

  But I think having kern.features sysctl is the better good way.

* Tested with a Synaptics Touchpad using both moused/sysmouse and
  libinput under X11. Both work reliably.

* Enables by default hw.psm.{synaptics,trackpoint,elantech}_support.

* Set hw.psm.mux_disabled=1 if your keyboard no longer works due
  to the AUX MUX code (I haven't synced the quirks code yet).

* atkbd - periodic polling is disabled. Can be turned on by setting
  loader tunable hw.atkbd.hz to 1 or 10 (as it was before).

## How to use this with Xorg

sysctl kern.evdev.rcpt_mask=6

Then, either add moused_enable=YES to /etc/rc.conf. Then you can
use this with the default xorg.conf.

To use this with libinput, which I do, I had to add the following to
/etc/X11/xorg.conf: 

```
Section "InputClass"
        Identifier "libinput pointer catchall"
        MatchIsPointer "on"
	    MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection
```

and in $HOME/.xinitrc:

```
xinput set-prop 'SynPS/2 Synaptics TouchPad' 'libinput Tapping Enabled' 1
```

to enable tapping. Not needed if sysmouse is used (requires running
moused). Scrolling feels better with libinput, but that is likely just
a better default setting.

## Open issues

* I haven't ported the following patch, which describes a LOR (lock order
  reversal) by using  evdev_register_mtx(). Maybe someone understands this
  patch or how to fix the LOR... an easy fix would be to use
  evdev_register() and using the internal evdev lock.

  https://github.com/freebsd/freebsd-src/commit/d276eae674d22214d6a58d1f4871053ceb0cb9f5

* The psmintr still runs using the mplock. Is that required or is it safe
  to add INTR_MPSAFE to BUS_SETUP_INTR?

* Before this patch, Xorg would recognize my mouse without moused
  running with the default configuration. This no longer works.

Regards,

  Michael


More information about the Users mailing list