2

I have an 5 year old laptop and I think the touchscreen is getting glitchy because my cursor is sometimes flickering and windows suddenly move and whatnot like my laptop is possessed. It started happening in Ubuntu 20.04 right before I did a completely fresh install of Ubuntu 22.04 where the problem persisted, so I don't think the OS is the culprit; I'm pretty sure the touchscreen.

I've tried

xinput disable 5

but I get

WARNING: running xinput against an Xwayland server. See the xinput man page for details.

and it doesn't disable the touchscreen.

I tried:

modprobe -r hid_multitouch

But that only disabled part of the touchpad (not the touchscreen) functionality.

So, what's the right way to disable the touchscreen on a fresh install of Ubuntu 22.04 (Wayland)? Thanks.

chimeraha
  • 515

3 Answers3

4

I followed this thread and created some scripts that work for a fresh install of ubuntu 22.04.

I couldn't figure out how to get awk's match function to work, so I just used code from @meuh and @JinnKo to create a non-awk version that disables/toggles multiple devices given a keyword.

First, make sure evtest is installed:

sudo apt install evtest

I have two files, one that toggles the touchscreen on and off, and one that always disables it when booting up.

Toggle Touchscreen:

#!/bin/bash
# This toggles my touchscreen
#search for "Touchscreen" or something like that in /proc/bus/input/devices to make sure you're disabling what you want to disable.

path_for_temp_files="/ANY_PATH_YOU_WANT_TO_STORE_SOME_PID_FILES/" regex='event([0-9]+)' DEVICE="Touchscreen"

if [ -r "${path_for_temp_files}touchscreen-evtest0.pid" ]; then kill_these_files=("${path_for_temp_files}"touchscreen-evtest*)

for i in "${kill_these_files[@]}"; do
    echo "kill" $(cat "${i}")
    sudo kill $(cat "${i}")
    sudo rm "${i}"
done  

else filename='/proc/bus/input/devices' inside=0 events=() while read line; do if [[ $line =~ $DEVICE ]]; then inside=1 fi

    if [[ $line =~ $regex ]]; then
        if [[ "$inside" -eq 1 ]]; then
            events+=("${BASH_REMATCH[1]}")
        fi
        inside=0
    fi
done < $filename

numevents=${#events[@]}

for (( i=0; i<${numevents}; i++ )); do
    sudo evtest --grab "/dev/input/event${events[$i]}" > /dev/null &
    pid=$!
    echo $pid > "${path_for_temp_files}touchscreen-evtest${i}.pid"
    echo "/dev/input/event${events[$i]} running on pid ${pid}"
done

fi

Disable Touchscreen to run at boot:

#!/bin/bash
# This disables my touchscreen
#search for "Touchscreen" or something like that in /proc/bus/input/devices to make sure you're disabling what you want to disable.

path_for_temp_files="/ANY_PATH_YOU_WANT_TO_STORE_SOME_PID_FILES/" regex='event([0-9]+)' DEVICE="Touchscreen"

if [ -r "${path_for_temp_files}touchscreen-evtest0.pid" ]; then kill_these_files=("${path_for_temp_files}"touchscreen-evtest*)

for i in "${kill_these_files[@]}"; do
    echo "kill" $(cat "${i}")
    sudo kill $(cat "${i}")
    sudo rm "${i}"
done  

fi

filename='/proc/bus/input/devices' inside=0 events=() while read line; do if [[ $line =~ $DEVICE ]]; then inside=1 fi

if [[ $line =~ $regex ]]; then
    if [[ "$inside" -eq 1 ]]; then
        events+=("${BASH_REMATCH[1]}")
    fi
    inside=0
fi

done < $filename

numevents=${#events[@]}

for (( i=0; i<${numevents}; i++ )); do sudo evtest --grab "/dev/input/event${events[$i]}" > /dev/null & pid=$! echo $pid > "${path_for_temp_files}touchscreen-evtest${i}.pid" echo "/dev/input/event${events[$i]} running on pid ${pid}" done

Then I followed this answer to run as root at startup

chimeraha
  • 515
0

I found none of the above worked (there is no Touchscreen device). So I switched from Wayland to X11, then ran xinput disable 11, 11 being what appeared to be a pointing device (xinput list):

⎜ ELAN2514:00 04F3:2AF2 id=11 [slave pointer (2)]

⎜ SYNA32A0:00 06CB:CE14 Mouse id=13 [slave pointer (2)]

⎜ SYNA32A0:00 06CB:CE14 Touchpad id=14 [slave pointer (2)]

ELAN and SYNAptics are two pointer chip types. I guessed the ELAN was the touchscreen.

To switch to X11, when you type in your login name, a gear appears in the bottom right of the login page. Click on that and select X11.

0

Although this is quite old I wanted to share that I used the accepted answer to create a little helper script for myself. The script dis- and enables Touch automatically based on the proximity of the stylus.

Currently I use used with Ubuntu 22.04 with wayland on my ThinkPad Yoga L13ut probably it is quite easy to adapt to other systems as well.

Ditschi
  • 31