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

Michael Neumann mneumann at ntecs.de
Thu Apr 18 00:01:10 PDT 2024


On Fri, Apr 12, 2024 at 09:36:39PM +0200, Antonio Huete Jimenez wrote:
> Started testing this on my Lenovo Thinkpad T480, so far it works like a
> charm! Just had to set the rcpt mask and it started work + gestures. Then
> went and enabled tapping with the xinput command.
> 
> I'll continue using it but if there are no unexpected crashes or problems I
> think you can just push it.

Hi Antonio,

Thanks for testing! In the meantime I also tested the patch on a Tuxedo
Laptop with great success. And I also incoorperated the patch from
bugreport #3206: https://bugs.dragonflybsd.org/issues/3206
Thanks to the author(s) for the work!

This leads to this new patch:

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

which further syncs the atkbd and kbd drivers with FreeBSD and also does
a lot of reformatting.

I'd highly appreciate it, if you could also test this
patch on your Lenovo. Anyone else is welcome too :).

I'll commit this in 1-2 weeks if there are no objections.

Regards,

  Michael

> 
> Thanks!
> Antonio Huete
> 
> On 4/11/24 13:56, karu.pruun wrote:
> > Hello
> > 
> > Great, thanks for doing this work! I'll try to test over weekend.
> > 
> > Best
> > 
> > Peeter
> > 
> > 
> > 
> > On Wed, Apr 10, 2024 at 11:41???AM Michael Neumann <mneumann at ntecs.de> wrote:
> > > 
> > > 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

-- 
Michael Neumann
NTECS Consulting
www.ntecs.de


More information about the Users mailing list