3d Connexion Space Navigator keyboard emulator (perfect for controlling XBMC)
C Lua
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
Makefile
README
spnavkbd.c
spnavkbd.lua

README

spnavkbd - 0.1
--------------

1. About

The spnavkbd tool makes use of the open source spacenavd daemon to react to
movements of a 3d Connexion Space Navigator and emulate key presses to control
traditional keyboard oriented applications (in my case XBMC).

2. Build dependencies

libspnav (known to work with 0.2.2). In the spnavkbd directory run:

  $ wget http://downloads.sourceforge.net/spacenav/libspnav-0.2.2.tar.gz
  $ tar -xf libspnav-0.2.2.tar.gz

And using your distros package manager make sure you have either Lua or
LuaJIT2 installed. On some systems (Debian) make sure you have the "*-dev"
versions of these package installed.

3. Building

Run:

  $ make

To use a custom compiler or to link against LuaJIT2 do:

  $ CC=clang LUA_PKG_NAME=luajit make

4. Installing

You can run the spnavkbd binary from anywhere but ensure you have the
spnavkbd.lua config file in the current working directory.

5. Configuring

See the spnavkbd.lua file for the full list of configuration options at this
time.

The 3d-mouse-to-key mappings in the default config were chosen to best control
XBMC for my car computer.

From a birds-eye POV pushing the knob forward, backward, left and right
simulate the up, down, left and right arrow keys respectively.

Pushing down the knob simulates a Return press and pulling the knob up is a
BackSpace.

Twisting the knob in a clockwise and anti-clockwise directions simulate '-' &
'+' keys for volume control.

Button 0 (left button) is Escape to return to the top menu and button 1 is Tab
to switch between file view and the visualisation screen.

Tilting forward, backward, left and right doesn't do anything useful yet.

6. Caveats

At the moment you need to run spnavkbd as the same user of the applications
you which to control.

You can *probably* still launch spnavkbd from an rc or init script with:

  (*Note* this isn't working for me yet)
  # cd /path/to/spnavkbd/dir/
  # DISPLAY=:0.0 XAUTHORITY=$(ps -C X -f --no-header | sed -n 's/.*-auth //; s/ -[^ ].*//; p') su mason -c ./spnavkbd

Change 'X' to 'xinit' depending on how you launch X. And change 'mason' to the
user of the applications you wish to control.

Also make sure this is run after X has been started.