Tuesday, November 6, 2018

Fix for touchpad jitter on Razer Blade Stealth (Late 2017, 13.3") on Ubuntu 18.10

Update 11/20/18: See below. Kernel update 4.19.2 fixes jitter, but there may be some useful config options toward the bottom of the post.

I've been having an issue on my recently purchased Razer Blade Stealth 13.3" where the mouse jitters when making fine movements on the touchpad.

First thing I tried was updating the kernel to the latest 4.19.1 mainline kernel from the kernel PPA to see if a newer kernel driver would fix the issue. I had to disable secure boot for it to work; otherwise, GRUB would complain about an invalid signature, and I wasn't about to go through the rigmarole of signing the kernel. More importantly, it didn't fix my touchpad issue.

Someone suggested switching to the synaptics driver for the touchpad instead of libinput. So I went about installing the synaptics driver by running:

$ sudo apt install xserver-xorg-input-synaptics

But that didn't fix the issue. Turns out, libinput was still catching the touchpad. Rather than uninstalling the libinput driver, I decided to use the Xorg configuration files to keep libinput from catching the touchpad. The libinput driver catches every input device, so it is worth keeping it around for the keyboard, touchscreen, etc.

If you want to modify the Xorg configuration files specific to the libinput and synaptics drivers, first you need to copy them to the proper directory. Don't just blindly copy and paste; make sure the filenames are correct before running the commands.

$ sudo mkdir -p /etc/X11/xorg.conf.d
$ sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d
$ sudo cp /usr/share/X11/xorg.conf.d/70-synaptics.conf /etc/X11/xorg.conf.d

Then you can edit the files. I only ended up editing the libinput one. I like to use vim, but you can use whatever editor you like.

$ sudo vim /etc/X11/xorg.conf.d/40-libinput.conf

Then you need to find the part that looks like this:

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Comment out that entire section by putting pound signs (#) at the beginning of each line:

#Section "InputClass"
#        Identifier "libinput touchpad catchall"
#        MatchIsTouchpad "on"
#        MatchDevicePath "/dev/input/event*"
#        Driver "libinput"
#EndSection

Save the file and exit vim (press ESC, then type :wq<Enter> for those who don't know how). Log out and log back in, and the change should have taken effect! Just to be sure:

$ grep "input driver" ~/.local/share/xorg/Xorg.0.log
...
[  3469.568] (II) Using input driver 'synaptics' for '1A586757:00 06CB:8323 Touchpad'
...

Success! Now there is no more mouse jitter! Something to keep in mind is that since we're now no longer using libinput, we can't use libinput-gestures for fancy three finger swipes and whatnot. It isn't a big deal since I don't use them anyway.

Hopefully this will be helpful to someone running a Razer Blade Stealth 13.3" with Ubuntu (or, really, to anyone who wants to switch touchpad drivers under Linux). I mainly wrote this up so I don't forget what I did to fix the issue.

Update 11/20/18

Simply switching to the synaptics driver didn't completely fix the issue. I had to edit the HorizHysteresis and VertHysteresis values in the xorg.conf file (/etc/X11/xorg.conf.d/70-synaptics.conf):

Section "InputClass"
 Identifier "User options"
 MatchDriver "synaptics"
 MatchIsTouchpad "yes"
 Option "HorizHysteresis" "15"
 Option "VertHysteresis" "15"
 Option "CoastingSpeed" "10"
 Option "CoastingFriction" "40"
 Option "VertScrollDelta" "-50"
 Option "HorizScrollDelta" "50"
EndSection

I also adjusted the scrolling values so it wouldn't be ridiculously fast. These settings didn't completely fix the jitter when making larger movements, but at least it wasn't nearly as bad when making fine movements. That was good enough for me, so I left it that way.

Today I upgraded to kernel 4.19.2 from the kernel ppa, and now moving the mouse is just as smooth as on Windows. I plan on keeping the synaptics driver active because I've found scrolling settings that I like.

No comments:

Post a Comment