I’m using a laptop that comes with a touchscreen plus stylus and after about 3 years the pen input hardware seems to be failing. The problem presents itself by by generating phantom pen movements to a certain area of the screen. It’s impossible to use a normal mouse or touchpad when this is happening.
I found that the stylus pen input was causing the issue by disabling input devices one-by-one and checking if it helped.
$ xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ ELAN2514:00 04F3:2817 id=9 [slave pointer (2)] ⎜ ↳ SYNA329A:00 06CB:CD4F Mouse id=11 [slave pointer (2)] ⎜ ↳ SYNA329A:00 06CB:CD4F Touchpad id=12 [slave pointer (2)] ... ⎜ ↳ USB OPTICAL MOUSE id=28 [slave pointer (2)] ⎜ ↳ ELAN2514:00 04F3:2817 Stylus Pen (0) id=29 [slave pointer (2)]
$ xinput disable 29
Permanent Solution
StackExchange was helpful again – it’s possible to add a Xorg.conf rule to disable the device by name:
Section "InputClass" Identifier "Disable broken pen input" MatchProduct "ELAN2514:00 04F3:2817 Stylus" Option "Ignore" "on" EndSection
The rule needs to go into a new file located in /usr/share/X11/xorg.conf.d
(ubuntu)
Most of the advice I’ve found is using the Ignore
option, but this didn’t seem to work for me. I could no longer see the device in xinput list
, but the cursor was still going haywire, and now I couldn’t even stop it with xinput. The stylus input is an I2C device and I suppose it was still being handled outside of xinput.
Unfortunately, it’s not possible to set xinput
device props using X.Org rules – using Option "Device Enabled" "0"
. doesn’t work.
Floating
When going through the supported values for “Option” in the xorg documentation (https://www.x.org/releases/current/doc/man/man5/xorg.conf.5.xhtml) I noticed there was a “Floating” option:
Option “Floating” “boolean“
When enabled, the input device is set up floating and does not report events through any master device or control a cursor. The device is only available to clients using the X Input Extension API. This option is disabled by default.
The updated configuration rule works! The events are not propagated to the master device and the random cursor movements have stopped.
Section "InputClass" Identifier "Disable broken pen input" MatchProduct "ELAN2514:00 04F3:2817 Stylus" Option "Floating" "on" EndSection
By the way, it’s also possible to set devices as floating using xinput
:
$ xinput float 29 ... $ xinput list ⎡ Virtual core pointer id=2 [master pointer (3)] ... ⎣ Virtual core keyboard id=3 [master keyboard (2)] ... ∼ ELAN2514:00 04F3:2817 Stylus Pen (0) id=29 [floating slave]