Disable Touchscreen in Gnu/Linux

(7 comments)

Some of new laptops have touchscreen functionality. It is fancy, but practically it is useless. Mostly, you touch it by mistake and it uses some battery.

Recently I cracked my laptop's screen, it is a small crack that doesn't distract me but somehow it is making some random touches. I was searching for ways to disable touchscreen and most of them wasn't working and touchscreen was enabled again after reboot or sleep.

You can temporarily disable your touchscreen (or any other input device) using xinput tool. Use xinput --list to get the list of your input devices and use their id to disable any of them: xinput disable <id number>.

I added this command to the autostart to disable at boot:

xinput --list | awk '/Atmel Atmel maXTouch Digitizer/ {print $7}' | awk '{split($0,a,"="); print a[2]}' | xargs xinput disable

It works fine, it finds the id number of the touchscreen device (it can change at boot) using its name (Atmel Atmel maXTouch Digitizer - from xinput list) and disables it. The only problem is that, touchscreen becomes enabled again after sleep. Also, for some unknown reason, it is not working at every reboot.

There is also another way, disable the module for the touchscreen device, but I hate that way as missing modules are annoying.

X11:

My final solution that worked well was to create a configuration file in X11 and add a general touchscreen disabling setting to it. For example, I have created /etc/X11/xorg.conf.d/94-no-touchscreen.conf file and added this content to it:

Section "InputClass"
    Identifier         "Touchscreen catchall"
    MatchIsTouchscreen "on"
    Option "Ignore" "on"
EndSection

That works both on reboots and on waking from the sleep mode.

Wayland:

Find vendor and product id of the device using cat /proc/bus/input/devices - In the output try to find your touchscreen device and use its Vendor=<VendorID> Product=<ProductID> value to create an udev rule. Create a file /etc/udev/rules.d/94-no-touchscreen.conf with the following content (replace VendorID and ProductID with according values):

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

Note: To find more about your touchscreen device, you can use udevadm tool. Sysfs flag of input devices (after vendor & product id and name lines) will give a hint about the path of the device, use udevadm info /<path under the /dev to get detailed information for that device.

You can restart after that or reload rules: udevadm control --reload-rules && udevadm trigger

Sources:

1. Answer by Dmitry in stackoverflow.

Current rating: 3.7

Comments

Jonas19 4 years, 5 months ago

Thanks man it worked

Link | Reply
Current rating: 5

Erik Magni 3 years, 9 months ago

Nice article. I have not destroyed my touchscreen (yet) but would like to disable it more or less permanently. I like to have it disabled at boot and have the option to easy switch it on when needed. So if anyone could suggest a way to switch it on would I be glad.

Link | Reply
Current rating: 5

Emin Mastizada 3 years, 9 months ago

Unless you have a hardware switch for it, disabling and enabling easily is not possible. The disabling using "xinput" command will disable for the current session and will work again after the reboot, but this way it can be activated/disabled anytime. With the second option, adding ignore line to the `xorg.conf` disables the driver itself, so it will be disabled after reboot and it will not be possible to turn it on as the driver for it is ignored.

Link | Reply
Currently unrated

Morgan 3 years, 8 months ago

I'm running Wayland. This seems like an X solution, but also it seems to have worked. Should this work for Wayland as for X?
Thank you.

Edit:
For Wayland, I found this:
https://askubuntu.com/a/1011125

Link | Reply
Currently unrated

Emin Mastizada 3 years, 6 months ago

Yes, the article is almost 2 years old and I'm still haven't switched to Wayland yet (last 3 attempts had bugs, will make another attempt soon).
The reason why it worked in Wayland (at least the first part) is because `xinput` should work there too, but using something like `libinput` may be might be better. An `udev rule` in Wayland can be used to disable the device permanently.

Will update the article for Wayland, Thank you.

Link | Reply
Currently unrated

Morgan 3 years, 7 months ago

For Wayland, I found this:
https://askubuntu.com/a/1011125

Link | Reply
Currently unrated

Jesse Moseman 3 years, 6 months ago

You can just disable the kernel module hid_multitouch in the grub menu.

Link | Reply
Current rating: 3

New Comment

required

required (not published)

optional

required