How To: Install the Leap Motion Driver & SDK outside of Ubuntu/Debian Linux

The Leap Motion Leap sensor forms part of some research I’m working on atm, but the drivers only come as .debs packaged for Ubuntu or other Debian-based distros. As I’m on Arch (and don’t really want to run dpkg alongside pacman), I wanted a way to pull out the files from the .deb bundle and stick them in the right place. Luckily, it’s pretty easy to do – here’s how…

Download and Extraction

So, let’s say you go to https://developer.leapmotion.com/downloads and get yourself a copy of the most recent Linux driver, which at the time of writing is: Leap_Packages_1.0.9+8411_Linux.tgz.

Extracting the archive will give you two files:
Leap-1.0.9+8411-x64.deb, and
Leap-1.0.9+8411-x86.deb.

If you look at either of those two files with Archive Manager you’ll see the file data.tar.gz within ’em. Pick your flavour (32-bit is x86, while 64-bit is x64) and extract it.

Inside the data folder you’ve just extracted you’ll find three directories:
etc,
lib, and
usr.

Scripted Install

In the folder with the above etc, lib and usr folders, create a file (call it anything you like, install-leap.sh for example) and dump the following into it:

Now chmod +x the file so it’s executable and we’re almost ready to go. Unfortunately this doesn’t allow for that easy uninstallation, but you can just manually ‘nix it by throwing the following into another script:

Optional: Reload udev rules

Try skipping this section for now and come back to it if your device doesn’t register, ok?

Apparently udev uses the inotify mechanism so you don’t need this (source: http://unix.stackexchange.com/questions/39370/how-to-reload-udev-rules-without-reboot) but I did this anyway and it worked:

Start the daemon & visualiser

Now that’s all done, you should be able to start the Leap daemon with:

Then plug your leap sensor in and it should work when you run ‘Visualizer’ or such. Cheers!

Leap visualiser on Linux

Update – July 2016

Doing this again today, I needed to move the contents of the /usr/share/Leap folder (i.e. *.ldat) to the /usr/local/sbin folder for leapd to start without errors – also, as mentioned, be sure to run leapd as sudo or it’ll launch (with websocket errors) but it won’t work. Also, I moved the *.so files, “platform” folder and “Playground_Data” folders into /usr/local/bin, which has made that folder a bit of a dog’s breakfast, but it works… Probably a better idea to use “alien” to install the deb, or make a PKGBUILD on arch than this hacky way of cobbling it together.

How To: Downgrade libcairo2 in Debian (and fix Evince)

Evince crashing with a libcairo segfault like this?

It’s a libcairo2 1.12.2-2 issue – which you can thankfully fix by downgrading libcairo2 to a 1.10.2 incarnation – here’s how…

Check package availability

First check you have an alternate version to downgrade to. To do this in Synaptic select the libcairo2 package then click on the Versions tab at the bottom, or you can do the same check via a swift apt-cache policy libcairo2 as shown below:

In this case the older (but functional) package 1.10-2-2ubuntu2 is available. Let’s assume there’s an older package you can use – if not, go get one from elsewhere.

Uninstall and force a different version

Uninstall libcairo2 using any manner you like – this will also force removal of things like Evince as dependencies, unless you see anything spectacular that you know you need just let it.

Then in Synaptic, search for libcairo2, select it (i.e. click on it), then from the Synaptic menu choose Package > Force Version and choose the older, working package, and install it.

Next, you’ll want to lock to that version so it doesn’t get upgraded (at least until there’s a newer working version), so again from the menu just select Package > Lock Version.

Reinstall libcairo-using things

Finally, reinstall what was ailing ya and everything should work fine. In my case at least, this means I can reinstall the Evince PDF viewer and it’ll now print to PDF without segfaulting – Huzzah! =D

I’ve no doubt you can do this entire process from the command line, but it’s easy and works through Synaptic so I’ll leave that as an exercise for the reader.

As an added bonus, if you’re experiencing slow display and/or corrupted text in Iceweasel or Chromium then the downgrade should fix that up too. You can read more about which here.