Morphius - sorta fix for interference between USI stylus and hid_multitouch

I saw this post https://forum.chrultrabook.com/t/c13-yoga-gen-1-morphius-touchscreen-stops-working-after-using-stylus/7935/4

I’ve got the same issue with Ultramarine 43 Gnome version which obviously is wayland only.

I suppose this issue might affect other devices than Morphius, but I can’t say that for sure.

In some way, every time the stylus gets close to the screen, finger input gets disabled not only for the time the stylus is being used, but until you modprobe hid_multiouch.

Stylus and finger share the same input group (number 7) and kernel gives priority to the stylus. For some unknown reason, even when the stylus goes away from the screen, the kernel “thinks” that’s it’s still in use so finger input is disabled forever.

For reference

Touchscreen GDIX0000:00 27C6:0ED0 /dev/input/event6 7 i2c:27c6:0ed0
Stylus GDIX0000:00 27C6:0ED0 Stylus /dev/input/event7 7 i2c:27c6:0ed0

At first I wrote a service to keep in track with TABLET_TOOL_PROXIMITY - proximity-out event, i.e. a a tool able to detect when the stylus goes away from the screen, so that I could launch a script modprobing hid_multitouch. It worked but was very unstable and made the UI sluggish.

So I chose a much simpler and lower tech way: a bash script with a good old button to tap on. The only issue is that modprobe requires sudo and inserting a password but sudoers can help us.

That’s it

This one is the bash script that modprobes hid_multotouch (modprobe -r and modprobe to be fair).

sudo nano /usr/local/bin/stylus_fix.sh

# Description: Unloads and reloads the hid_multitouch module to restore finger touch input.

LOG_FILE=“/var/log/stylus_fix.log”

echo “$(date): Starting hid_multitouch reset.” >> “$LOG_FILE”

# 1. Attempt to remove the module (ignore errors if not loaded or locked)

/usr/bin/modprobe -r hid_multitouch 2>/dev/null

MODPROBE_R_STATUS=$?

if [ $MODPROBE_R_STATUS -ne 0 ]; then

echo "$(date): WARNING: modprobe -r failed (Code $MODPROBE_R_STATUS). Module may be aggressively locked." >> "$LOG_FILE"

fi

# 2. Re-insert the module (the actual fix)

/usr/bin/modprobe hid_multitouch

MODPROBE_STATUS=$?

if [ $MODPROBE_STATUS -eq 0 ]; then

echo "$(date): SUCCESS: hid_multitouch reloaded. Touch input should be restored." >> "$LOG_FILE"

else

echo "$(date): ERROR: modprobe failed (Code $MODPROBE_STATUS). Could not restore touch input." >> "$LOG_FILE"

fi

This is the desktop file

nano ~/.local/share/applications/stylus-fix.desktop

[Desktop Entry]

Name=Restore Finger Touch (Stylus Fix)

Comment=Resets hid_multitouch driver to re-enable finger touch input.

Exec=sudo /usr/local/bin/stylus_fix.sh

Icon=input-tablet

Terminal=false

Type=Application

Categories=Utility;System;

You obviously may choose a different and more beatiful icon by setting its path, it’s a trivial desktop file, not rocket science!

And last step the exception in sudoers

sudo nano /etc/sudoers.d/stylus_fix_nopasswd

NAMEOFTHEUSER ALL=(root) NOPASSWD: /usr/local/bin/stylus_fix.sh

(where NAMEOFTHEUSER stands for the name of the user, I won’t share mine)

and

sudo chmod 0440 /etc/sudoers.d/stylus_fix_nopasswd

is for setting permissions.

I installed a wayland extension named Frippery Panel Favorites which allowed me to place the button that restores touch input on the top panel so I can use the stylus, briefly touch the button with it and get back a fully functional touchscreen.

It’s not an actual fix which would probably require a deep knowledge of wayland and libinput (which is not my cup of tea because I’m just a guy who uses Gnu Linux for his work and likes things to work) but I find it a smart practical solution.

I hope it may help other users:)

1 Like

Problem solved after the most recent updates. As of now, using the stylus doesn’t break hid_multitouch any longer and my script is useless.