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
  • 73,717
mnr
  • 1,017

8 Answers8

86

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
  • 17,371
romaia
  • 978
39

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
  • 543
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.

4

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
  • 213
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
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
Gabriel Staples
  • 11,502
  • 14
  • 97
  • 142
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
  • 213
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,533
Soner
  • 1