Touchpad click not working

Hello,

I have a Thinkpad P14s with a Synaptics TM3471-020 touchpad, which
doesn’t work well with NixOS. Specifically, the left button click is
not detected (the left button tap is detected correctly).

In my /etc/nixos/configuration.nix I have:

  services.xserver = {
    enable = true;
    layout = "us";
    xkbOptions = "eurosign:e";

    # Gnome
    displayManager.gdm.enable = true;
    desktopManager.gnome3.enable = true;

    videoDrivers = [ "modesetting" "nvidia" ];

    libinput.enable = true;
    # Tried to configure the touchpad here, but this crashes xserver:
    # inputClassSections = [''
    #   Identifier "Synaptics TM3471-020"
    #   Driver "libinput"
    #   MatchIsTouchpad "on"
    #   Device "/dev/input/event*"
    #   Option "AccelProfille"        "adaptive,flat"
    #   Option "ClickMethod"          "buttonareas,clickfinger"
    #   Option "DisableWhileTyping"   "true"
    #   Option "HorizontalScrolling"  "true"
    #   Option "LeftHanded"           "false"
    #   Option "MiddleEmulation"      "false"
    #   Option "NaturalScrolling"     "false"
    #   Option "ScrollMethod"         "twofinger,edge"
    #   Option "SendEventsMode"       "enabled"
    #   Option "Tapping"              "true"
    #   Option "TappingDrag"          "true"
    # ''];
  };

The touchpad seems to be correctly recognized by Xorg on boot:

# journalctl -b
...
(II) config/udev: Adding input device Synaptics TM3471-020 (/dev/input/event6)
(**) Synaptics TM3471-020: Applying InputClass "evdev touchpad catchall"
(**) Synaptics TM3471-020: Applying InputClass "libinput touchpad catchall"
(**) Synaptics TM3471-020: Applying InputClass "libinput touchpad configuration"
(II) Using input driver 'libinput' for 'Synaptics TM3471-020'
(II) systemd-logind: got fd for /dev/input/event6 13:70 fd 42 paused 0
(**) Synaptics TM3471-020: always reports core events
(**) Option "Device" "/dev/input/event6"
(**) Option "_source" "server/udev"
(II) event6  - Synaptics TM3471-020: is tagged by udev as: Touchpad
(II) event6  - Synaptics TM3471-020: device is a touchpad
(II) event6  - Synaptics TM3471-020: device removed
(**) Option "Tapping" "on"
(**) Option "TappingDragLock" "on"
(**) Option "AccelProfile" "adaptive"
(**) Option "NaturalScrolling" "off"
(**) Option "SendEventsMode" "enabled"
(**) Option "LeftHanded" "off"
(**) Option "ScrollMethod" "twofinger"
(**) Option "DisableWhileTyping" "off"
(**) Option "HorizontalScrolling" "on"
(**) Option "config_info" "udev:/sys/devices/rmi4-00/input/input8/event6"
(II) XINPUT: Adding extended input device "Synaptics TM3471-020" (type: TOUCHPAD, id 15)
(**) Option "AccelerationScheme" "none"
(**) Synaptics TM3471-020: (accel) selected scheme none/0
(**) Synaptics TM3471-020: (accel) acceleration factor: 2.000
(**) Synaptics TM3471-020: (accel) acceleration threshold: 4
(II) event6  - Synaptics TM3471-020: is tagged by udev as: Touchpad
(II) event6  - Synaptics TM3471-020: device is a touchpad
...
# libinput list-devices
...
Device:           Synaptics TM3471-020
Kernel:           /dev/input/event6
Group:            9
Seat:             seat0, default
Size:             97x65mm
Capabilities:     pointer gesture
Tap-to-click:     enabled
Tap-and-drag:     enabled
Tap drag lock:    disabled
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   *two-finger edge
Click methods:    none
Disable-w-typing: enabled
Accel profiles:   flat *adaptive
Rotation:         n/a
...
$ xinput list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Synaptics TM3471-020                    	id=15	[slave  pointer  (2)]
⎜   ↳ TPPS/2 Elan TrackPoint                  	id=16	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Video Bus                               	id=8	[slave  keyboard (3)]
    ↳ Sleep Button                            	id=9	[slave  keyboard (3)]
    ↳ Intel HID events                        	id=12	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=13	[slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                  	id=14	[slave  keyboard (3)]
    ↳ Integrated Camera: Integrated I         	id=11	[slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C         	id=10	[slave  keyboard (3)]
$ sudo xinput list-props 15
Device 'Synaptics TM3471-020':
	Device Enabled (187):	1
	Coordinate Transformation Matrix (189):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	libinput Tapping Enabled (324):	1
	libinput Tapping Enabled Default (325):	1
	libinput Tapping Drag Enabled (326):	1
	libinput Tapping Drag Enabled Default (327):	1
	libinput Tapping Drag Lock Enabled (328):	0
	libinput Tapping Drag Lock Enabled Default (329):	0
	libinput Tapping Button Mapping Enabled (330):	1, 0
	libinput Tapping Button Mapping Default (331):	1, 0
	libinput Natural Scrolling Enabled (332):	0
	libinput Natural Scrolling Enabled Default (333):	0
	libinput Disable While Typing Enabled (334):	1
	libinput Disable While Typing Enabled Default (335):	1
	libinput Scroll Methods Available (336):	1, 1, 0
	libinput Scroll Method Enabled (337):	1, 0, 0
	libinput Scroll Method Enabled Default (338):	1, 0, 0
	libinput Accel Speed (339):	0.235294
	libinput Accel Speed Default (340):	0.000000
	libinput Accel Profiles Available (341):	1, 1
	libinput Accel Profile Enabled (342):	1, 0
	libinput Accel Profile Enabled Default (343):	1, 0
	libinput Left Handed Enabled (344):	0
	libinput Left Handed Enabled Default (345):	0
	libinput Send Events Modes Available (309):	1, 1
	libinput Send Events Mode Enabled (310):	0, 0
	libinput Send Events Mode Enabled Default (311):	0, 0
	Device Node (312):	"/dev/input/event6"
	Device Product ID (313):	1739, 0
	libinput Drag Lock Buttons (346):	<no items>
	libinput Horizontal Scroll Enabled (347):	1

I have an Archlinux install on the same laptop, where the touchpad
works out of the box. The libinput list-devices command in
particular shows Click methods: *button-area clickfinger. I think
this is what’s missing on NixOS:

# libinput list-devices
...
Device:           Synaptics TM3471-020
Kernel:           /dev/input/event9
Group:            9
Seat:             seat0, default
Size:             97x65mm
Capabilities:     pointer gesture
Tap-to-click:     disabled
Tap-and-drag:     enabled
Tap drag lock:    disabled
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *two-finger edge 
Click methods:    *button-areas clickfinger 
Disable-w-typing: enabled
Accel profiles:   flat *adaptive
Rotation:         n/a

Here is the diff between Archlinux (red) and NixOS (green):

diff --git a/libinput-list-devices-arch b/libinput-list-devices-nixos
index ce2b03b..3fc07fb 100644
--- a/libinput-list-devices-arch
+++ b/libinput-list-devices-nixos
@@ -1,18 +1,18 @@
 Device:           Synaptics TM3471-020
-Kernel:           /dev/input/event9
+Kernel:           /dev/input/event6
 Group:            9
 Seat:             seat0, default
 Size:             97x65mm
 Capabilities:     pointer gesture
-Tap-to-click:     disabled
+Tap-to-click:     enabled
 Tap-and-drag:     enabled
 Tap drag lock:    disabled
 Left-handed:      disabled
 Nat.scrolling:    disabled
-Middle emulation: disabled
+Middle emulation: n/a
 Calibration:      n/a
 Scroll methods:   *two-finger edge
-Click methods:    *button-areas clickfinger
+Click methods:    none
 Disable-w-typing: enabled
 Accel profiles:   flat *adaptive
 Rotation:         n/a
\ No newline at end of file

Also, on Archlinux, xinput list-props shows three extra properties:

	libinput Click Methods Available (337):	1, 1
	libinput Click Method Enabled (338):	0, 1
	libinput Click Method Enabled Default (339):	1, 0

For reference, on NixOS:

$ uname -a
Linux thinpad-p14s 5.11.9 #1-NixOS SMP Wed Mar 24 10:54:19 UTC 2021 x86_64 GNU/Linux

$ libinput --version
1.16.4

On Archlinux (note that the libinput version is different):

$ uname -a
Linux thinkpad-p14s 5.11.11-arch1-1 #1 SMP PREEMPT Tue, 30 Mar 2021 14:10:17 +0000 x86_64 GNU/Linux

$ libinput --version
1.17.1

So to fix this, I have to load the psmouse kernel module with synaptics_intertouch=0. I found this in the “debugging touchpad” section of the Ubuntu wiki.

I added this to the kernel parameters in /etc/nixos/configuration.nix:

boot.kernelParams = [ "psmouse.synaptics_intertouch=0" ];
3 Likes