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!
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…
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?
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:
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.
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]...
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.
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.
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!