How to disable laptop touchscreen?

Hi, I’m sure this is probably super easy but I’m having trouble figuring out how to disable the touchscreen on my laptop. It’s bugging out with phantom touches so I just want to disable it since I never use it anyway.

I’m running Gnome with wayland, if that helps.

I found something about using xinput to disable things but it doesn’t seem to have any effect, unless I’m doing it wrong. I figured I’d ask before I mess something up!

~ ❯ 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:14                     	id=6	[slave  pointer  (2)]
⎜   ↳ xwayland-relative-pointer:14            	id=7	[slave  pointer  (2)]
⎜   ↳ xwayland-pointer-gestures:14            	id=8	[slave  pointer  (2)]
⎜   ↳ xwayland-tablet stylus:14               	id=11	[slave  pointer  (2)]
⎜   ↳ xwayland-tablet eraser:14               	id=12	[slave  pointer  (2)]
⎜   ↳ xwayland-touch:14                       	id=10	[slave  pointer  (2)]
⎜   ↳ xwayland-tablet cursor:14               	id=13	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ xwayland-keyboard:14                    	id=9	[slave  keyboard (3)]

OK I’m making progress! Here’s what I did.

I installed evtest and then ran sudo evtest. It returns a list of devices. You can chose a device and then touch your touchscreen and see if it registers any input. This narrows down which devices needs to be disabled. For me it turned out to be device 14, which of course had no helpful designation like “touchscreen.”

Now that I determined my touchscreen device, I could then run sudo evtest --grab /dev/input/event14 >> /dev/null and voila my touchscreen is disabled!

Of course this only disables it temporarily. Now I just need to figure out how to run it on boot as root…

I also wonder if device 14 is always device 14 on boot or if it can change if things are plugged in, like USB devices or whatnot. If that’s the case I’ll need to make a fancier script…

1 Like

Admittedly, I am out of my depth here but how about finding out what the driver for the touchscreen is and blacklist it in order for impeding it to load at boot.

I just did a quick search and mtouchusb driver came up. could it be that one?

1 Like

I think you can try to create a udev rule for that. Create this file /etc/udev/rules.d/94-disable-touchscreen.conf with the following contents:

SUBSYSTEM=="{add subsys}", ATTRS{idVendor}=="VendorID", ATTRS{idProduct}=="ProductID", ATTR{authorized}="0"

Note that you have to figure out the subsystem, vendor, etc. first before the rule can work.

After creating the config file, run udevadm control --reload-rules && udevadm trigger

1 Like

Woohoo, got it! Udev was indeed the solution. Here’s a step by step for future people who might be trying to do something similar:

  1. Identify your touchscreen device by running sudo evtest (install evtest if necessary). It will return a list of devices, make your best guess and then touch your touchscreen. If it registers input, that’s the device you’re looking for. The event number changes on every boot. In this example, my device happened to be /dev/input/event15.

  2. Now that you know the device, you can set up a udev rule for it. Run
    sudo udevadm info --attribute-walk --name=/dev/input/event15
    (Replace /dev/input/event15 with whatever device you’re dealing with). This will return a bunch of info that will help you write a matching rule. In my case, it looked like this:

  looking at device '/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/i2c-ELAN2097:00/0018:04F3:2504.0006/input/input25/event15':
    KERNEL=="event15"
    SUBSYSTEM=="input"
...[REMOVED EXTRA STUFF HERE]...

  looking at parent device '/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/i2c-ELAN2097:00/0018:04F3:2504.0006/input/input25':
    KERNELS=="input25"
    SUBSYSTEMS=="input"
...[REMOVED EXTRA STUFF HERE]...
    ATTRS{id/product}=="2504"
    ATTRS{id/vendor}=="04f3"
...[REMOVED EXTRA STUFF HERE]...
  1. To write my rule, I created a file
    /etc/udev/rules.d/94-ignore-touchscreen.rules
    (I believe it must end in .rules in order to work).
    With the contents:
    ACTION=="add|change", KERNEL=="event[0-9]*", ATTRS{id/vendor}=="04f3", ATTRS{id/product}=="2504", ENV{LIBINPUT_IGNORE_DEVICE}="1"
    You can match from the first device (I used KERNEL) and you can match multiple attributes from a single subsequent device (I used id/vendor and id/product). You have to match it exactly how it prints in your terminal, there seems to be no standard for attribute names. It could be id/vendor like mine, or it could be VENDOR_ID or something else.

  2. Now that you’ve saved the udev rule, you can test it’s working properly. First, get the name of the device with
    sudo udevadm info --query=path --name=/dev/input/event15
    And then test the rule with that name: sudo udevadm test /devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/i2c-ELAN2097:00/0018:04F3:2504.0006/input/input25/event15
    If your rule is working properly, you should see “LIBINPUT_IGNORE_DEVICE=1” near the end of the output.

  3. Finally, reboot. For me, running sudo udevadm control --reload and sudo udevadm trigger was not enough to disable the touchscreen right away. Once I rebooted, however, the touchscreen was properly disabled!

3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.