Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 3047  / 1 Year ago, thu, december 1, 2022, 12:45:46

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.


More From » 22.04

 Answers
1

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


[#464] Thursday, December 1, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
beateyra

Total Points: 499
Total Questions: 113
Total Answers: 125

Location: Falkland Islands
Member since Mon, Jul 13, 2020
4 Years ago
beateyra questions
Mon, Jul 11, 22, 17:35, 2 Years ago
Wed, Sep 22, 21, 13:51, 3 Years ago
Tue, Jan 3, 23, 12:05, 1 Year ago
Mon, Sep 26, 22, 09:51, 2 Years ago
Tue, May 18, 21, 22:32, 3 Years ago
;