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.

Friday, January 19, 2018

Fix for Slime Rancher black screen and performance issues on Ubuntu 17.10



Hey all!

Finally posting on the blog again! (Don't expect a weekly post or anything though; I'm mainly going to use this as a platform to share the things I've learned through troubleshooting, etc. I'll post content whenever I feel the need to.)

The Story


I recently bought a game called Slime Rancher on the Steam winter sale for around $13 (here's the link if you're interested). It's got a simple premise, the gameplay is fairly straightforward, it isn't frustrating, and it's a ton of fun to play. Best of all, it's cross-platform, and even has a version for our beloved open-source operating system!

The only problem is that it doesn't actually work properly out of the box.

The Problem


When I started the game, it loaded to a black screen, no matter how many times I retried loading the game or checking the integrity of the game files. I thought originally that there was some sort of runtime issue (as is often the case with games not loading). I ran it in the terminal and didn't see anything weird on the command line, so I took to the web.

And so I stumbled upon a Steam Community post on this very topic. Except you don't need to (and in fact shouldn't) do most of the stuff it tells you to do.

The Solution


Here's the part that's important. You need to go into the game's properties in the Steam client, select "Set Launch Options..." and type in "-screen-fullscreen 0" (without the quotes). That's it. For whatever reason, the game doesn't load properly if it starts in full screen. Once it loads up, it will go into full screen and allow you to set the resolution for the game, etc.

The problem with their solution


In my experience, you don't need to create a desktop shortcut for this to work, and you certainly don't need to have root privileges to create said shortcut. The forum posts suggests that if there is an error creating the desktop shortcut, run chmod 777 / to temporarily elevate root, and then change it back to 755 afterwards (the problem was that he was trying to create a shortcut on the filesystem root). First of all, if you run that command as a normal user, it will throw a permissions error, i.e.:

chmod: changing permissions of '/': Operation not permitted

Second, if you actually do change the permissions of a folder to 777 (or worse, do it recursively), then you are opening up that folder for any user on the system to be able to read or write from it, regardless of whether they own the file or not. If you do that on the filesystem root, the results could be catastrophic. Don't do that to yourself.

The moral of the story is this: don't go blindly copying and pasting commands from the internet without first knowing what the commands are doing to your system. Especially if they have a sudo tacked on the front.

</rant>

Anyhow, I'd also like to mention performance issues on Linux, since no one else seems to be talking about it.

Performance


I'm running Slime Rancher on my strictly Linux gaming rig, based on an Athlon X4 860K and GTX 960 (build log here; updated here if you're interested in the story behind that). I'm currently running Ubuntu Budgie 17.10.

After a couple of performance tweaks, I'm getting around 60 FPS most of the time, with dips down to 45 FPS and minimum tearing, at the highest graphical settings, vsync off, at 1080p.

Seriously, turn off vsync


I normally like to have vsync on wherever I can, because it usually gives me a smoother experience without any of the tearing, and with minimal input lag. However, I cannot recommend having vsync on for this game, as the stuttering and lag that happens when you do have it enabled is absolutely atrocious. Plus, since the game usually hovers around 60 FPS anyway, the screen tearing that results from having vsync off is hardly noticeable.

Disable unredirect (if applicable)


This is an option that will be specific to your desktop environment, but it actually will give you a noticeable uplift in performance. In Budgie, you can find the setting in the Budgie Desktop Settings here, under "Windows":


YMMV on other desktop environments. I know for a fact that Xfce and Cinnamon have options in their respective settings managers to disable compositing for fullscreen windows (in Xfce it should be under "Window Manager Tweaks, then "Compositing"; in Cinnamon it's under "General"). I believe KDE does as well, but I couldn't point you to where it is off the top of my head.

Conclusion


Slime Rancher is a really fun game, and the issues that it has on Linux are fairly minor and can be mitigated easily. Happy gaming!

Sunday, May 25, 2014

How to watch a video in ASCII art

Prerequisites


  • VLC or mplayer
  • libcaca (libcaca0 on Ubuntu/Debian; should already be installed)
  • A video to watch (I downloaded one from YouTube using youtube-dl)
Linux users tend to know what they're doing, so I'll assume you know how to install these programs. Plus, installation is highly distro-specific, so I'm not going to elaborate further.

mplayer


Open your favorite terminal emulator or switch to a VT and run:

mplayer -vo caca video

where video is the video file you wish to play.

This option is a lot more friendly to the Linux console, but I found that the picture itself in VLC was a lot better.


mplayer with libcaca

VLC


In my opinion, this will get you better results. The colors seem to be a bit more true to the video and not quite as random; also, the window can be resized with the video resizing along with it. Running this in the Linux console does not give good results: VLC's messages show up in the black bars above and below the video (if there are black bars) and to quit one does not simply press the "q" key. A keyboard interrupt also does not work.


Command line


Open your favorite terminal emulator (under X11) and run:

vlc --vout=caca video

where video is the video file you wish to play.

GUI


Open VLC, and go to Tools->Preferences. Then, go into the "Video" section, and, next to "Output", select "Color ASCII art video output".

VLC preferences

Click Save. Open your favorite video in VLC and:

VLC with libcaca

Conclusion


Even though libcaca doesn't provide the most accurate ASCII art renderings of pictures and videos, the results are still impressive and it's something cool and geeky you can show off to your friends. 

Friday, August 17, 2012

Use WICD instead of NetworkManager in Ubuntu 12.04

In Kubuntu 12.04, I have noticed that NetworkManager doesn't like to work after a resume from sleep. So I will show you how to replace it with WICD, which is a whole lot more reliable.

Prerequisites

  • Any flavor of Ubuntu, version 12.04
  • An already-working internet connection with NetworkManager
  • NetworkManager not successfully connecting after resume from sleep

How to make the switch

First, install WICD. Open a terminal and type:

sudo apt-get install wicd

Note that this installs wicd-gtk. This is okay for Kubuntu users, as the GTK client is a lot easier to use than the KDE one.

Second, uninstall NetworkManager.

sudo apt-get --purge autoremove network-manager

That's it! Enjoy WICD.

Wednesday, August 15, 2012

Multiple .minecraft's easily switchable with MCProfileMan [discontinued]

N.B.: This project is no longer under development and the link is broken. The profile switcher in Minecraft itself works just fine.

Hello everyone, and welcome to my new blog Linux Tips & Tricks. I will show you MCProfileMan, which was made by me and creates easily switchable .minecraft's.

Prerequisites

  • Any Linux distro.
  • Minecraft. If you do not play Minecraft, do not continue, as this script will be useless to you.
Otherwise, there's nothing else. zip is a standard Linux program, so there's nothing to install and this will work on all Linux distros.

How to use

Obviously, you need to download it.
Open a terminal (e.g. Ctrl+Alt+T in Gnome or Konsole in KDE).
Make sure you're in the download directory (usually Downloads):
cd Downloads
Extract the script:
unzip mcprofileman_0.3.zip
Make it executable:
chmod +x mcprofiles
Now the script is ready to use. You can add a profile like so:
./mcprofiles add
Then it will prompt you for a name and create the profile. You can switch it with your current .minecraft like so:
./mcprofiles switch
It will show a list of the profiles (numbered) and prompt for a number; then it will prompt for a name for the profile that was your .minecraft.
Run ./mcprofiles usage for more.