Config to disable laptop's touchscreen capability?

tl;dr possible to setup a config-based disablement of touchscreen’s touch-interactions? I think I’ve identified the faulty touchscreen via xinput below (and I’m 99% sure there’s no bios disable-option; I hunted around that UI thrice already). I’d love to hear I’m wrong about BIOS though… that’d be much easier.

I have a Lenovo ThinkPad X1 Nano Gen 1 (20UN005JUS) for which the laptop’s screen just got violently stepped on. It’s still usable and crystal clear, except the touchscreen sensor is now erratically detecting inputs. I am able to disable it via xinput --disable 9 (the device listed as xwayland-keyboard:15 id=9 [slave keyboard (3)]), but I’m obviously looking for a way to codify this properly in my nix config files. Can anyone point me in the right direction?

$ xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ xwayland-pointer:15                     	id=6	[slave  pointer  (2)]
⎜   ↳ xwayland-relative-pointer:15            	id=7	[slave  pointer  (2)]
⎜   ↳ xwayland-pointer-gestures:15            	id=8	[slave  pointer  (2)]
⎜   ↳ xwayland-touch:15                       	id=10	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ xwayland-keyboard:15                    	id=9	[slave  keyboard (3)]
$ sudo xinput --disable 9
$ xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ xwayland-pointer:15                     	id=6	[slave  pointer  (2)]
⎜   ↳ xwayland-relative-pointer:15            	id=7	[slave  pointer  (2)]
⎜   ↳ xwayland-pointer-gestures:15            	id=8	[slave  pointer  (2)]
⎜   ↳ xwayland-touch:15                       	id=10	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
∼ xwayland-keyboard:15                    	id=9	[floating slave]

two new websearches I’m trying:

  • a. “nixos libinput” to see if there’s a general guide on passing commands like above but via config
  • b. “gnome 40 disable touchscreen” to see if there’s alternatives to my above method (libinput gives me warnings about my wayland usage)

udev investigation

the latter reveals this ZorinOS forum thread with a suggestionffor a new udev rule setting ATTR{authorized}="0" for the matching device (the full line given:SUBSYSTEM=="usb", ATTRS{idVendor}=="VID", ATTRS{idProduct}=="PID", ATTR{authorized}="0"). udev sounds better because I know there’s good udev config support in nixos, but I’m not sure what my device IDs would be… I see the following when running lsusb:

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 003: ID 04f2:b6ea Chicony Electronics Co., Ltd Integrated Camera
Bus 003 Device 004: ID 8087:0026 Intel Corp. AX201 Bluetooth
Bus 003 Device 005: ID 06cb:00bd Synaptics, Inc. Prometheus MIS Touch Fingerprint Reader
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

I’m guessing my touchscreen, if it’s even listed there, is one of the first three lines or the last line. If anyone has ideas/knowledge here, please share!

Searching the web for how to identify a screen in udev’s terms, I only found a udevadm info CLI, but it doesn’t reveal anything that makes me confident I’m even looking at the right item:

output of `udevadm info --query=property --name=/dev/input${i}` run in a loop
$ xinput
WARNING: running xinput against an Xwayland server. See the xinput man page for details.
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ xwayland-pointer:15                     	id=6	[slave  pointer  (2)]
⎜   ↳ xwayland-relative-pointer:15            	id=7	[slave  pointer  (2)]
⎜   ↳ xwayland-pointer-gestures:15            	id=8	[slave  pointer  (2)]
⎜   ↳ xwayland-touch:15                       	id=10	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
∼ xwayland-keyboard:15                    	id=9	[floating slave]

udevadm output for '2'...
     1	+:38:: udevadm info --query=property --name /dev/input/event2
     2	DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input3/event2
     3	DEVNAME=/dev/input/event2
     4	MAJOR=13
     5	MINOR=66
     6	SUBSYSTEM=input
     7	USEC_INITIALIZED=34340048
     8	PATH=/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/bin:/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/sbin
     9	ID_INPUT=1
    10	ID_INPUT_SWITCH=1
    11	ID_PATH=acpi-PNP0C0D:00
    12	ID_PATH_TAG=acpi-PNP0C0D_00
    13	LIBINPUT_DEVICE_GROUP=19/0/5:PNP0C0D/button
    14	TAGS=:power-switch:
    15	CURRENT_TAGS=:power-switch:
udevadm output for '4'...
     1	+:38:: udevadm info --query=property --name /dev/input/event4
     2	DEVPATH=/devices/platform/INTC1051:00/input/input5/event4
     3	DEVNAME=/dev/input/event4
     4	MAJOR=13
     5	MINOR=68
     6	SUBSYSTEM=input
     7	USEC_INITIALIZED=34353564
     8	PATH=/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/bin:/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/sbin
     9	ID_INPUT=1
    10	ID_INPUT_KEY=1
    11	ID_PATH=platform-INTC1051:00
    12	ID_PATH_TAG=platform-INTC1051_00
    13	DEVLINKS=/dev/input/by-path/platform-INTC1051:00-event
    14	TAGS=:power-switch:
    15	CURRENT_TAGS=:power-switch:
udevadm output for '6'...
     1	+:38:: udevadm info --query=property --name /dev/input/event6
     2	DEVPATH=/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-1/i2c-ELAN0670:00/0018:04F3:3150.0001/input/input17/event6
     3	DEVNAME=/dev/input/event6
     4	MAJOR=13
     5	MINOR=70
     6	SUBSYSTEM=input
     7	USEC_INITIALIZED=34701632
     8	PATH=/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/bin:/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/sbin
     9	ID_INPUT=1
    10	ID_INPUT_TOUCHPAD=1
    11	ID_INPUT_WIDTH_MM=98
    12	ID_INPUT_HEIGHT_MM=53
    13	ID_SERIAL=noserial
    14	ID_PATH=pci-0000:00:15.0-platform-i2c_designware.0
    15	ID_PATH_TAG=pci-0000_00_15_0-platform-i2c_designware_0
    16	LIBINPUT_DEVICE_GROUP=18/4f3/3150:i2c-ELAN0670:00
    17	DEVLINKS=/dev/input/by-path/pci-0000:00:15.0-platform-i2c_designware.0-event-mouse
udevadm output for '7'...
     1	+:38:: udevadm info --query=property --name /dev/input/event7
     2	DEVPATH=/devices/platform/i8042/serio1/input/input6/event7
     3	DEVNAME=/dev/input/event7
     4	MAJOR=13
     5	MINOR=71
     6	SUBSYSTEM=input
     7	USEC_INITIALIZED=34702196
     8	PATH=/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/bin:/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/sbin
     9	ID_INPUT_POINTINGSTICK=1
    10	ID_INPUT=1
    11	ID_INPUT_MOUSE=1
    12	ID_BUS=i8042
    13	ID_SERIAL=noserial
    14	ID_PATH=platform-i8042-serio-1
    15	ID_PATH_TAG=platform-i8042-serio-1
    16	LIBINPUT_DEVICE_GROUP=11/2/a:isa0060/serio1
    17	DEVLINKS=/dev/input/by-path/platform-i8042-serio-1-event-mouse
udevadm output for '8'...
     1	+:38:: udevadm info --query=property --name /dev/input/event8
     2	DEVPATH=/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/i2c-ELAN901C:00/0018:04F3:2BB5.0002/input/input18/event8
     3	DEVNAME=/dev/input/event8
     4	MAJOR=13
     5	MINOR=72
     6	SUBSYSTEM=input
     7	USEC_INITIALIZED=34702232
     8	PATH=/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/bin:/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/sbin
     9	ID_INPUT=1
    10	ID_INPUT_TOUCHSCREEN=1
    11	ID_INPUT_WIDTH_MM=275
    12	ID_INPUT_HEIGHT_MM=181
    13	ID_PATH=pci-0000:00:15.1-platform-i2c_designware.1
    14	ID_PATH_TAG=pci-0000_00_15_1-platform-i2c_designware_1
    15	LIBINPUT_DEVICE_GROUP=18/4f3/2bb5:i2c-ELAN901C:00
    16	DEVLINKS=/dev/input/by-path/pci-0000:00:15.1-platform-i2c_designware.1-event
udevadm output for '10'...
     1	+:38:: udevadm info --query=property --name /dev/input/event10
     2	DEVPATH=/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/i2c-ELAN901C:00/0018:04F3:2BB5.0002/input/input20/event10
     3	DEVNAME=/dev/input/event10
     4	MAJOR=13
     5	MINOR=74
     6	SUBSYSTEM=input
     7	USEC_INITIALIZED=35044579
     8	PATH=/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/bin:/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/sbin
     9	ID_INPUT=1
    10	ID_PATH=pci-0000:00:15.1-platform-i2c_designware.1
    11	ID_PATH_TAG=pci-0000_00_15_1-platform-i2c_designware_1
    12	LIBINPUT_DEVICE_GROUP=18/4f3/2bb5:i2c-ELAN901C:00
    13	DEVLINKS=/dev/input/by-path/pci-0000:00:15.1-platform-i2c_designware.1-event
udevadm output for '3'...
     1	+:38:: udevadm info --query=property --name /dev/input/event3
     2	DEVPATH=/devices/LNXSYSTM:00/LNXPWRBN:00/input/input4/event3
     3	DEVNAME=/dev/input/event3
     4	MAJOR=13
     5	MINOR=67
     6	SUBSYSTEM=input
     7	USEC_INITIALIZED=34344217
     8	PATH=/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/bin:/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/sbin
     9	ID_INPUT=1
    10	ID_INPUT_KEY=1
    11	ID_PATH=acpi-LNXPWRBN:00
    12	ID_PATH_TAG=acpi-LNXPWRBN_00
    13	LIBINPUT_DEVICE_GROUP=19/0/1:LNXPWRBN/button
    14	TAGS=:power-switch:
    15	CURRENT_TAGS=:power-switch:
udevadm output for '5'...
     1	+:38:: udevadm info --query=property --name /dev/input/event5
     2	DEVPATH=/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-1/i2c-ELAN0670:00/0018:04F3:3150.0001/input/input15/event5
     3	DEVNAME=/dev/input/event5
     4	MAJOR=13
     5	MINOR=69
     6	SUBSYSTEM=input
     7	USEC_INITIALIZED=34701086
     8	PATH=/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/bin:/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/sbin
     9	ID_INPUT=1
    10	ID_INPUT_POINTINGSTICK=1
    11	ID_INPUT_MOUSE=1
    12	ID_SERIAL=noserial
    13	ID_PATH=pci-0000:00:15.0-platform-i2c_designware.0
    14	ID_PATH_TAG=pci-0000_00_15_0-platform-i2c_designware_0
    15	LIBINPUT_DEVICE_GROUP=18/4f3/3150:i2c-ELAN0670:00
    16	DEVLINKS=/dev/input/by-path/pci-0000:00:15.0-platform-i2c_designware.0-event-mouse
udevadm output for '9'...
     1	+:38:: udevadm info --query=property --name /dev/input/event9
     2	DEVPATH=/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/i2c-ELAN901C:00/0018:04F3:2BB5.0002/input/input19/event9
     3	DEVNAME=/dev/input/event9
     4	MAJOR=13
     5	MINOR=73
     6	SUBSYSTEM=input
     7	USEC_INITIALIZED=34702267
     8	PATH=/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/bin:/nix/store/z6q01drqm7y4ndzp9yvjr1i89irvz7lv-udev-path/sbin
     9	ID_INPUT=1
    10	ID_PATH=pci-0000:00:15.1-platform-i2c_designware.1
    11	ID_PATH_TAG=pci-0000_00_15_1-platform-i2c_designware_1
    12	LIBINPUT_DEVICE_GROUP=18/4f3/2bb5:i2c-ELAN901C:00
    13	DEVLINKS=/dev/input/by-path/pci-0000:00:15.1-platform-i2c_designware.1-event

cat /proc/bus/input/devices also has some interesting/relevant-looking input, but not sure how to utilize it yet…

tl;dr tips to disable hid-multitouch via nixos config?

On my millionth websearch I finally came across a working manual-solution, but still seeking help to declare via nixos config.

manual-fix: touch driver's API: the unbind file in /sys/bus/hid/drivers/hid-multitouch

Manual solution

So here’s the solution I found: I can disable the touchscreen via linux kernel driver hid-multitouch:

  1. list the currently bound multitouch devices:
$ ls -la /sys/bus/hid/drivers/hid-multitouch/

# you'll see symlinks here named after the ID of the device.
# eg: for me:
# - _one_ was my mouse-touchpad
# - the _other_ was my cracked touchscreen
  1. unbind one at a time until you identify which is the culprit:
$ echo SOME_DEVICE_ID_HERE |
  sudo tee /sys/bus/hid/drivers/hid-multitouch/unbind

# or re-enable via:
$ echo SOME_DEVICE_ID_HERE |
  sudo tee /sys/bus/hid/drivers/hid-multitouch/bind

So I’ve confirmed I have the correct device ID, and disabling it fixes my issues. Now to do this persistently across reboots…

TBD: how to do this via .nix configs…

Obviously I’d like to do that manual fix via nix config, eg: /etc/nixos/hardware-configuration.nix? But I’m not seeing anything obvious with my current web searches.

I’m guessing my options are:

  1. appears not. option 1: I discover an “optoin” in configs (ie: someone has written a pretty nixlang hook for bind/unbind file trickery)…
    • seems preferable to option 2, as the intent is a little clearer…
    • Am I correct that if such a hook exists it’d be listed in this giant reference: Appendix A. Configuration Options
      • if that’s correct, then I think I’m out of… no matches search that page for hid-, hidMulti, or touch
    • Edit: no luck: /hid.*multi/ search against github.com/NixOS doesn’t reveal much, so gonna go with “no”
  2. option 2: I discover how to run arbitrary commands (ie: my manual-fix) as part of the derivation…
    • seems subpar to option 1? but better than nothing…
    • not sure how to find this… i"m searching Appendix A. Configuration Options for instances of the word script right now (>500 matches)…

not a “solution” but since this thread is super old, I’ll state the progress: