3dspace
prerequsites:
sudo apt-get install libudev-dev libusb-1.0-0-dev libfox-1.6-dev sudo apt-get install libhidapi-dev # installs (hidraw0, libusb0) sudo apt-get install libmodbus-dev
for ccmake:
HIDAPI_HIDRAW_INCLUDE_DIR /usr/include/hidapi HIDAPI_INCLUDE_DIR /usr/include/hidapi HIDAPI_LIBRARY /usr/lib/x86_64-linux-gnu/libhidapi-hidraw.so HIDAPI_LIBUDEV /usr/lib/x86_64-linux-gnu/libhidapi-libusb.so HIDAPI_LIBUDEV_INCLUDE_DIR /usr/include/hidapi
==
http://janoc.rd-h.com/archives/74 say's:
3DConnexion SpaceNavigator in Linux
Existing SpaceNavigator Support
3DConnexion makes a nice 6DOF device reminiscent of the old SGI Spaceball – a 6DOF joystick (3 translations + 3 rotations/twists).
In Linux there are several options how to get it to work:
Official 3DConnexion drivers The Linux driver is obviously derived from the Unix drivers and requires several things that are poor design decisions – Motif (OpenMotif works), root permissions to run the daemon and modification of /etc/inittab if the driver is installed using the provided script. Moreover, the daemon tries to open an X window with configuration and will not work right without it. This is difficult on most Linux distributions due to the X access controls, requiring nasty things like xhost+ and similar. Overall, the design is a security liability. Applications need to connect to the device using specially written clients/plugins. Moreover, the driver is proprietary, with no source code, causing problems with compatibility. Spacenav project – a free re-implementation/drop in replacement of the official driver. Not full-featured yet. VRPN – A good choice for VR applications. I have contributed the Linux support for the SpaceNavigator using the Linux USB input framework (HID devices). libndofdev – Library originally distributed to support SpaceNavigator on Windows and OSX by 3DConnexion, now maintained by Linden Labs, makers of Second Life to support SpaceNavigator in Second Life client. The library has no real Linux support yet, however I wrote a compatible drop-in replacement using the published API that allows Second Life viewers use both joysticks and SpaceNavigator on Linux (see below).
Installing SpaceNavigator without the official driver
Make sure the evdev kernel module is loaded (e.g. via /etc/modprobe.preload) The SpaceNavigator device file will appear as /dev/input/event*, the correct device can be found by typing dmesgright after connecting the Navigator. Then look for a lines similar to:
usb 7-2.3: new low speed USB device using uhci_hcd and address 26 usb 7-2.3: configuration #1 chosen from 1 choice input: 3Dconnexion SpaceNavigator as /class/input/input73 input,hidraw5: USB HID v1.10 Multi-Axis Controller [3Dconnexion SpaceNavigator] on usb-0000:00:1d.1-2.3
The important line is the one starting with input: 3Dconnexion. Type ls /sys/<class/input/input*>, filling in the info from this line and you will obtain:
$ ls /sys/class/input/input73 capabilities/ device event5/ id/ input:event5 modalias name phys power/ subsystem uevent uniq
The device is then connected as event5, the correct path being /dev/input/event5, in my case. Most likely regular users will not have access to the device (the default on most Linux distros). The official drivers work this around by running everything as root, which is a security problem. A better approach is either using chmod (need to be done after every reboot and every re-connection of the device) or using udev rules. /etc/udev/rules.d/41-spacenavigator-acl.rules /etc/udev/rules.d/41-spacenavigator.rules
These rules will ensure that the currently logged in user will automatically be granted access to the device. Also, a convenience symlink /dev/input/spacenavigator will be created. Note: The rules above are designed for Mageia Linux, different distros (Ubuntu, Suse, …) may need different rules. If your Linux uses HAL for device management, it is possible that your Navigator will be recognized as a mouse and the cursor on the screen will keep moving when you apply pressure on the cap. Annoying. In order to fix that, we have to tell X to ignore the device by removing the “input.x11_driver” key. Create the file /etc/hal/fdi/policy/90-spacenav-nox11.fdi (right click and “Save link as …” – the file will appear empty in the browser if you only click on the link!) Restart your system. The problem should be fixed.
Using the SpaceNavigator
There are not many programs able to use SpaceNavigator in Linux right now. However, adding support is fairly simple. Apart from using VRPN, which is an overkill for simple projects, it is easy to use the device directly using the input framework as HID device.
spacenavig.c This example is in public domain, credit is appreciated.
Note: If you have the official driver installed (or spacenav driver, not tested), you need to stop the daemon otherwise the example will not work.