Joaquim Rocha
Published on

Leap Motion on Fedora 19

Authors
  • avatar
    Name
    Joaquim Rocha
    Twitter
  • Principal Software Engineering Manager at Microsoft

I was one of the fortunate developers who got one of the first Leap Motion development units. Unfortunately the SDK was only available for Windows and Mac OS so, since I couldn’t use it, I started a topic on Leap’s developer forum to ask for a Linux SDK. The number of users joining the petition kept increasing until Leap released an SDK (closed source binaries) for Linux about 4 months ago… when I was moving to a different country and had left my, then useless, Leap device in my parents’ attic 🙂 (thanks to my brother for sending it to me)

The SDK for Linux is actually a deb package intended for Ubuntu and, although there is also a tarball with the compiled shared libs and examples, as far as I could check, only the deb package provides the demon and other useful tools. Since I am running Fedora, that meant that I had to allocate a bit more of my time to explore this wonderful device.

The device will officially launch tomorrow so I thought I could write a little set of steps for Fedora (and maybe other distros) users to play with it. The only dependency that I think is necessary to install is mesa-libGLU.x86_64 for running the visualizer.

I cooked a little video showing how it works before the boring sections below:

Install the Leap SDK

First we need to download and extract the deb package (at the time of writing, the SDK was no longer available to download until they release it, hopefully in less then a day). If you are a rebel and have dpkg installed on your Fedora like I do, go ahead and do: $ dpkg -x Leap-0.8.0-x64.deb Leap-0.8.0 or, if you don’t want to use dpkg: $ mkdir Leap-0.8.0 && ar p Leap-0.8.0-x64.deb data.tar.gz | tar zx

Inside the Leap-0.8.0 folder there will two folders: usr and lib .

Copy (as root) the rules file to the udev rules directory: # cp lib/udev/rules.d/25-com-leapmotion-leap.rules /etc/udev/rules.d/

Then we need to add our user to the “plugdev” group. If it doesn’t exist, create it (as root): # groupadd plugdev # usermod -a -G plugdev YOUR_USER_NAME

After this step it’s probably a good idea to restart your session…

As mentioned above, the deb ships a few binaries, found inside the usr/bin folder. It contains the leapd service, a Visualizer, a Recalibrate tool, a LeapControlPanel and a ScreenLocator (this one segfaults on my machine and I didn’t care why). I prefer to put these and other files inside my user’s .local folder: $ cp bin/* ~/.local/bin/

Notice that, except for leapd, all other binaries have an upper case name and, most of them, a rather generic one which some users might want to change (e.g. to leap-visualizer, leap-calibrator, etc.) before copying them. I will not change them in this example.

There are also some configuration files that need to be copied from usr/share/: $ cp -R usr/share/Leap ~/.local/share/

At this point we can already play with the Leap Motion device by running the leapd service and using e.g. the visualizer (it might be a good idea to actually recalibrate the device before using it, with the Recalibrate tool): $ leapd & $ Visualizer

Development

All is done except for the development libraries. If you want to develop you own stuff using Leap, you should have libLeap.so in your libraries’ path. This .so can be found in usr/lib/Leap, inside the extracted deb, or you can download the Leap Developer Kit which brings are some bindings like Python (LeapPython.so) and Java (libLeapJava.so). Of course you can copy these libs directly into /usr/lib64/ but I prefer to have them in .local/lib/ and setting the LD_LIBRARY_PATH and, for Python, the PYTHONPATH, variables. To copy the libs from the folder extracted from the deb package: $ cp usr/lib/Leap/* ~/.local/lib/ To copy the libs from the Leap Developer Kit tarball (using a 64 bit architecture): $ cp LeapSDK/lib/x64/* ~/.local/lib/

After copying the .so files: $ export LD_LIBRARY_PATH=~/.local/lib $ export PYTHONPATH=~/.local/lib

Have fun with Leap Motion on Fedora!