62

I have a touchscreen, but the drivers are not working properly and interfere with my mouse.

Is it possible to disable my touchscreen , so that I can work again properly?

Jorge Castro
  • 71,754
mnr
  • 1,017

8 Answers8

85

You can try disabling the input device with the xinput command. First see what input devices you have, just type:

xinput

And you should see a list like:

$ xinput 
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Atmel Atmel maXTouch Digitizer            id=9    [slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                     id=13   [slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad                id=12   [slave  pointer  (2)]
...

Then you can disable the input device you want with this command:

xinput disable 9

Where 9 is the id of the device you want to disable. You can also use the device name between quotes.

In xinput version 1.5.99.1 , you need to do xinput set-prop 9 'Device Enabled' 0 instead. Oddly on xinput v1.6.2 the first way work.

Pablo Bianchi
  • 15,657
romaia
  • 968
  • 3
    This works on my lenovo yoga (2012) running ubuntu 14.04. – Jeremy Upsal Apr 28 '16 at 21:11
  • 12
    Works on Dell XPS 13 running Ubuntu 16.04. I also added this to ~/.profile to auto apply after reboots: xinput | grep 'ELAN Touchscreen' | grep -Po 'id=\d+' | cut -d= -f2 | xargs xinput disable – TalkLittle Sep 10 '16 at 19:50
  • Atmel also seems pretty common, an alternative way as @TalkLittle: xinput enable \xinput | grep Atmel | sed "s/^.id=([0-9]).*$/\1/"``. Command inside What does backticks return the id. – Pablo Bianchi Mar 11 '17 at 15:53
  • Thank you. works on dell inspiron 13 7000 series running Ubuntu 16.10 – durga Aug 02 '17 at 06:51
  • This is a gt on reat option. I prefer a way to turn i – midopa Jul 22 '18 at 20:59
  • Alternative to @TalkLittle and @PabloBianchi solutions: xinput | grep "SYNAPTICS Synaptics Large Touch Screen" | awk '{match($0,"id=([0-9]+)",matches)}END{print matches[1]}' | xargs xinput disable – olfek Mar 06 '19 at 12:58
  • Alternative to all of the above: xinput disable $(xinput list --id-only "[Entire touch device name]") – Stephen Angelico Dec 15 '19 at 08:25
  • I've scripted this and attached it to a shortcut, Ctrl + Alt + P, here: https://askubuntu.com/a/1206493/327339 – Gabriel Staples Jan 29 '20 at 02:14
  • Works on Lenono Yoga 500 Ubuntu 18 – Dinesh Shekhawat Mar 23 '20 at 08:00
  • This works on my Lenovo Yoga-730 15iwl on Ubuntu 20.04: xinput disable \xinput --list | grep -i 'touch ' | sed 's/id=//g' | cut -f2`` – rubo77 Jul 09 '20 at 16:20
  • Thank you! On my Hp Elitebook G3 1040 this worked:

    book:~$ xinput ⎡ Virtual core pointer id=2 [master pointer (3)] ... ⎜ ↳ ATML1000:00 03EB:8A7F id=14 [slave pointer (2)] ... ⎜ ↳ ALP0013:00 044E:120A Touchpad id=17 [slave pointer (2)] ... ⎣ Virtual core key... book:~$ xinput disable 14 book:~$ xinput disable 17

    As you see the device 14 has NO Description, it came very handy to disable the touchpad, because sometimes during typing it reacts to input...

    – ant0nwax Oct 24 '22 at 07:31
38

The xinput solution did not work for me. I instead followed the instructions in this thread. This will disable it at boot time.

  1. Edit /usr/share/X11/xorg.conf.d/10-evdev.conf
  2. Add Option "Ignore" "on" to the end of the section with the touchscreen identifier
  3. Reboot

enter image description here

  • For the record (Google), I have a Samsung Series 7 and my touch screen was listed as ELAN Touchscreen in xinput.
  • JFTR too, in this question says the power consumption difference is mostly negligible.
anon
  • 533
  • Thanks, it worked on my XPS 13 9343 (2015), the touch screen was listed evdev touchscreen. – hg8 Jul 09 '15 at 18:59
  • This worked on my lenovo yoga (2012). – Jeremy Upsal Nov 03 '15 at 18:40
  • 2
    I did that on a Dell XPS and it disabled the screen completely. After booting the screen is just black. Booted in recovery mode, removed the line and everything went back to normal. – pieroxy Jan 06 '16 at 15:46
  • 1
    This prevented my laptop for rebooting into X windows. Not a big deal to remove that setting, but something newbies want to check they can do before trying it. – Davide Mar 02 '16 at 17:28
  • FYI to future users (and self): This no longer works on my lenovo yoga. It gives the same problem that @pieroxy experienced. – Jeremy Upsal Apr 28 '16 at 21:08
  • Same problem on asus taichi, x fails to load completely – Gjordis Aug 23 '16 at 12:50
  • I have added this suggestion on my x1 carbon. I thought I had everything setup while working with my external monitor and usb mouse with the laptop closed. But the next time I booted up without my external setup, the trackpad did not work. – jerome Oct 19 '16 at 17:55
  • 2
    Also disabled the touchpad on my Sony Vaio. Setting the driver value to "libinput" did the trick though – Jason Pawlak Mar 09 '17 at 22:26
  • 7
    On Ubuntu 17.10, I couldn't find the file you listed but there was /usr/share/X11/xorg.conf.d/40-libinput.conf. I changed a similar block in this file and at next restart I guess I'll find out how it went! – Oli Beatson Oct 22 '17 at 12:40
  • Re: Oliv's comment - same thing on Debian 10. – Joshua Boniface Feb 04 '21 at 18:22
  • 1
    @Oli Beatson';s worked for me Ubuntu 20..04 Ryzen 5 AMD . cracked screen. touchpad is ok . – pierrely Dec 08 '21 at 03:56
8

Edit file the file with

sudo nano /usr/share/X11/xorg.conf.d/10-evdev.conf

Change MatchIsTouchscreen from "on" to "off" in the Touchscreen section so it looks like this:

Section "InputClass"
    Identifier "evdev touchscreen catchall"
    MatchIsTouchscreen "off"
    MatchDevicePath "/dev/input/event*"
    Driver "evdev"
    EndSection

Save, Name and Exit

Touchscreen is disabled and no longer detected in xinput list.

  • This worked on my Lenovo ideacentre Flex 20, which had a cracked screen. – Merlin04 Aug 05 '17 at 23:59
  • This worked for Dell XPS 15 and Linux Mint 18. I think this is safer than using Option = ignore from the answer, as it doesn't disable the device just not doesn't treat it as a touch screen. – matt wilkie Jan 12 '18 at 18:46
  • This isn't working anymore. I updated to Ubuntu 18.04, and the 10-evdev.conf file is gone. I tried recreating it, but it didn't work. – Merlin04 May 08 '18 at 00:09
  • @Merlin04 Did you check the libinput file? There is an answer that mentions this: https://askubuntu.com/a/1038259/167115 – mchid Aug 06 '19 at 08:33
  • 2
    For me, on linux mint the file to edit was /usr/share/X11/xorg.conf.d/40-libinput.conf – Fed Dec 07 '20 at 11:34
2

As id for xinput changes on reboot, I added a simple one-line screen on session load:

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

My device's name is "Atmel Atmel maXTouch Digitizer", change that with your device (use xinput --list for device name).

Emin Mastizada
  • 278
  • 3
  • 15
2

In order to disable the touchscreen on Ubuntu 19.x and 20.x you can:

  • Wait the login screen
  • Press Alt+F2
  • Edit the "libinput" configuration and disable the touchscreen section, like that:
sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf 
# Match on all types of devices but joysticks
#
# If you want to configure your devices, do not copy this file.
# Instead, use a config snippet that contains something like this:
#
# Section "InputClass"
#   Identifier "something or other"
#   MatchDriver "libinput"
#
#   MatchIsTouchpad "on"
#   ... other Match directives ...
#   Option "someoption" "value"
# EndSection
#
# This applies the option any libinput device also matched by the other
# directives. See the xorg.conf(5) man page for more info on
# matching devices.

Section "InputClass" Identifier "libinput pointer catchall" MatchIsPointer "on" MatchDevicePath "/dev/input/event*" Driver "libinput" EndSection

Section "InputClass" Identifier "libinput keyboard catchall" MatchIsKeyboard "on" MatchDevicePath "/dev/input/event*" Driver "libinput" EndSection

Section "InputClass" Identifier "libinput touchpad catchall" MatchIsTouchpad "on" MatchDevicePath "/dev/input/event*" Driver "libinput" EndSection

#Section "InputClass" <----

Identifier "libinput touchscreen catchall" <---- this one

MatchIsTouchscreen "on" <---- put # in

MatchDevicePath "/dev/input/event*" <---- front of

Driver "libinput" <---- every line

#EndSection <----

Section "InputClass" Identifier "libinput tablet catchall" MatchIsTablet "on" MatchDevicePath "/dev/input/event*" Driver "libinput" EndSection

My "Dell Inspiron" touchscreen was broken. The cursor moved all over the place and click in random places several times a second. I was unable even to make login on the gnome or even to access the bios.

Lucas
  • 173
0

As @romaia's answer here shows, xinput is indeed the right way to do it.

However, I like to write a script and attach calling this script to a Ctrl + Alt + P keyboard shortcut, to make this super easy. Now I get an auto-closing window like this when I use this shortcut the first time:

enter image description here

...and if I use the shortcut again:

enter image description here

Ah, beautiful! Now I can easily enable/disable my touchpad or touchscreen, and fix mouse scroll speed, all with a single easy-to-use keyboard shortcut!

Get the latest version of this script here: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/toggle_touchpad.sh.

Here's a snapshot of it at this moment:

#!/bin/bash

# This file is part of eRCaGuy_dotfiles: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles

# toggle_touchpad.sh
# - toggle the touchpad & touchscreen on and off, and enable/disable imwheel to fix scroll speed when using a mouse
#   instead of the touchpad

# Gabriel Staples
# Started: 2 Apr. 2018 
# Update History (newest on TOP): 
#   28 Jan. 2020 - added in lines to disable Touchscreen too, as well as show ID numbers of 
#                  Touchscreen & Touchpad
#   22 June 2019 - added in the imwheel stuff to not mess up track pad scrolling when
#                  track pad is in use

# References (in order of progression):
# 1. negusp described xinput: https://askubuntu.com/questions/844151/enable-disable-touchpad/844218#844218
# 2. Almas Dusal does some fancy sed stuff & turns negusp's answer into a script: https://askubuntu.com/questions/844151/enable-disable-touchpad/874865#874865
# 3. I turn it into a beter script, attach it to a Ctrl + Alt + P shortcut, & do a zenity GUI popup window as well:
#    https://askubuntu.com/questions/844151/enable-disable-touchpad/1109515#1109515
# 4. I add imwheel to my script to also fix Chrome mouse scroll wheel speed problem at the same time:
#    https://askubuntu.com/questions/254367/permanently-fix-chrome-scroll-speed/991680#991680
# 5. I put this script on Github, and posted a snapshot of it on this answer here: 
#    https://askubuntu.com/questions/198572/how-do-i-disable-the-touchscreen-drivers/1206493#1206493 

# `xinput` search strings for these devices
# - Manually run `xinput` on your PC, look at the output, and adjust these search strings as necessary for your 
#   particular hardware and machine!
TOUCHPAD_STR="TouchPad"
TOUCHSCREEN_STR="Touchscreen"

read TouchpadId <<< $( xinput | sed -nre "/${TOUCHPAD_STR}/s/.*id=([0-9]*).*/\1/p" )
read TouchscreenId <<< $( xinput | sed -nre "/${TOUCHSCREEN_STR}/s/.*id=([0-9]*).*/\1/p" )
echo "TouchpadId = $TouchpadId" # Debug print
echo "TouchscreenId = $TouchscreenId" # Debug print

state=$( xinput list-props "$TouchpadId" | grep "Device Enabled" | grep -o "[01]$" )

PRINT_TEXT="Touchpad (ID $TouchpadId) &amp; Touchscreen (ID $TouchscreenId) "
if [ "$state" -eq '1' ];then
    imwheel -b "4 5" # helps mouse wheel scroll speed be better
    xinput --disable "$TouchpadId"
    xinput --disable "$TouchscreenId"
    zenity --info --text "${PRINT_TEXT} DISABLED" --timeout=2
else
    killall imwheel # helps track pad scrolling not be messed up by imwheel
    xinput --enable "$TouchpadId"
    xinput --enable "$TouchscreenId"
    zenity --info --text "${PRINT_TEXT} ENABLED" --timeout=2
fi

References (in order of progression):

  1. negusp described xinput: Enable/disable touchpad
  2. Almas Dusal does some fancy sed stuff & turns negusp's answer into a script: Enable/disable touchpad
  3. I turn it into a beter script, attach it to a Ctrl + Alt + P shortcut, & do a zenity GUI popup window as well: Enable/disable touchpad
  4. I add imwheel to my script to also fix Chrome mouse scroll wheel speed problem at the same time: Permanently fix Chrome scroll speed
  5. I put this script on Github, and posted a snapshot of it on this answer here: How do I disable the touchscreen drivers?
  6. Get the latest version of this script here! https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/toggle_touchpad.sh
0

In order to disable the touchscreen on Ubuntu (Xorg or Xwayland) you can:

  • Wait the login screen;
  • Press Alt+F3 to open a console;
  • Find the correct device id
  • Edit /etc/rc.local to disable the touchscreen device;
  • Make /etc/rc.local executable and reboot.
$ cd /sys/bus/hid/drivers/hid-multitouch
$ ls -1
  0003:2A94:5241.0006         <- my touchscreen
  0018:06CB:7621.0001         <- my touchpad
  bind
  (...)

then, test it:

$ sudo bash
$ cd /sys/bus/hid/drivers/hid-multitouch
$ echo "0003:2A94:5241.0006" > unbind
$ killall -9 Xorg

Setup rc.local to disable it on startup:

$ sudo nano /etc/rc.local
  #!/bin/sh
  ls -1 /sys/bus/hid/drivers/hid-multitouch | grep 0003:2A94:5241 > /sys/bus/hid/drivers/hid-multitouch/unbind
$ sudo chmod +x /etc.rc.local
$ reboot

I did this way because:

  • It doesn’t break my other multitouch devices;
  • It is simpler and works on Xorg and Xwayland;
  • The last 4 digits of the device change often on boot, therefore, I needed a solution that locate the correct device based on a simple rule;
  • My Dell Inspiron 5557 touchscreen is broken in such a way that I can’t access the bios or use a graphics environment, therefore, I needed a console solution.
Lucas
  • 173
0

If your touchscreen is a touch panel screen like a USB monitor, you can add default kernel driver usbtouchscreen into modprobe's blacklist file (/etc/modprobe.d/blacklist.conf) and use your custom driver such as touchkit or evtouch.

BuZZ-dEE
  • 14,223
Soner
  • 1