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 --reloadandsudo udevadm triggerwas not enough to disable the touchscreen right away. Once I rebooted, however, the touchscreen was properly disabled!