Getting A 3dconnexion Device Running In Ubuntu – Updated

by VitalBodies on April 21st, 2010

Getting A 3dconnexion Device Running In Ubuntu – Updated:

Update: We got it going in Blender!

VitalBodies recently bought a 3dConnexions 3D SpacePilot controller to use in Blender to help with the learning curve of the Blender interface. We got the proprietary driver going (in Ubuntu and POSSIBLY in Blender) using the steps below. We have gotten the device going in Blender 2.49 using the Open Source version for this tutorial plus a recompiled (for 64-bit)  plugin. After following a long trail of wreckage (within many many forum threads) of people that did not get the 3dconnexion 3D controller going in Ubuntu or 64-bit Ubuntu, we decided to start this “how to” post to consolidate information and show how to actually get it going.

OPEN SOURCE SPACENAV:

VitalBodies would like to thank the Spacenav project for creating open source drivers! http://spacenav.sourceforge.net/

In order to get the Spacenav driver/daemon going and configure and test it in Ubuntu, you need to install the latest daemon, libspnav and spnavcfg which are different files each with their own readme file. spnavcfg requires GTK+ 2 and Xlib headers to be installed which in Debian and Ubuntu can be satisfied by installing libgtk2.0-dev.

Download and extract the spacenav files to the Downloads folder from here: http://sourceforge.net/projects/spacenav/files/

If you are new to Linux or Ubuntu you might find the instructions in the readme files rather brief so we are attempting to help bring more users to driver heaven – In short, you need to download the files and then install them with ./configure, make, and sudo make install.

All of the installation steps (./configure, make, and sudo make install) are done from the terminal: Applications > Accessories > Terminal.

NOTE: Command Line Reference: https://help.ubuntu.com/9.10/basic-commands/C/

NOTE: In Ubuntu Karmic the default place to download files when using Firefox is: home/user_name/Downloads.

NOTE: When you start the terminal in Ubuntu it usually defaults to your home/user_name directory.

NOTE: Be aware that the version numbers might change…

We started by installing libgtk2.0-dev first using synaptic: System > Administration > Synaptic Package Manager > Search “libgtk2.0-dev” > Mark for installation > Apply > etc…

Next we needed to edit the libspnav-0.2.1/configure script using gedit:

cd
cd Downloads/libspnav-0.2.1
gedit configure

We changed this:

if [ "`uname -m`" = 'x86_64' ]; then
   libdir=lib64
fi

To this:

# if [ "`uname -m`" = 'x86_64' ]; then
#    libdir=lib64
# fi

libspnav Installation Commands:

cd Downloads
cp -R libspnav-0.2.1 /tmp/libspnav-0.2.1
cd
cd /tmp/libspnav-0.2.1
./configure
make
sudo make install

spnavcfg Installation Commands: (Requires GTK+ 2 and Xlib headers so install libgtk2.0-dev first using synaptic (see above))

cd
cd Downloads
cp -R spnavcfg-0.2.1 /tmp/spnavcfg-0.2.1
cd
cd /tmp/spnavcfg-0.2.1
./configure
make
sudo make install

spacenavd Installation Commands:

cd
cd Downloads
cp -R spacenavd-0.4 /tmp/spacenavd-0.4
cd
cd /tmp/spacenavd-0.4
./configure
make
sudo make install
sudo ./setup_init

Useful commands:

For starting, stopping and reading the log file: (Be sure not to start multiple instances of the driver)

gedit /var/log/spnavd.log
sudo /etc/init.d/spacenavd start
sudo /etc/init.d/spacenavd stop
spnavcfg

Running the spnavcfg command from the terminal brought up this:

Blender: In Blender you will need to copy the 3DxNdofBlender.plug file into the /home/user_name/.blender/plugins directory or wherever your plugs directory is located. If the plugin works for version you should be able to move the puck see the movement (like being able to fly around the cube). We had to be in the USER view port and the cursor needed to over that window. Top, side and front works also but once we moved we were automatically in user mode. Additionally the device has to be enabled and you can “check” that it is using the spnavcfg command from the terminal.

64-bit Plug File: For us to get the device to work using 64-bit Ubuntu and Blender we needed the proprietary plug file recompiled using 64-bit Ubuntu.  This was the final key that enabled us to get this working.

We want to thank RoboticGolem in the forums for helping us get this going! Thank you, thank you, thank you – it has been a long haul.

How do you recompile the driver?

In the blender plugin zip from 3dconnexion (3DxBlender2_47-Linux-i386.zip) there is a file called 3dcnxplug-lin.c

It says to use the command cc 3dcnxplug-lin.c -Iintern/ghost -Wall -lc -shared -fPIC -fvisibility=hidden -o 3DxNdofBlender.plug to compile it (more or less). It’ll fail unless you have the GHOST_Types.h file from the blender source (I just put it in the same directory).

cc 3dcnxplug-lin.c -Iintern/ghost -Wall -lc -shared -fPIC -fvisibility=hidden -o 3DxNdofBlender.plug

http://www.blender.org/forum/viewtopic.php?p=78503

http://www.3dconnexion.com/forum/viewtopic.php?p=18401

http://blenderartists.org/forum/showthread.php?t=182325

(From the Daemon Readme)

1. About
Spacenavd, is a free software replacement user-space driver (daemon), for
3Dconnexion’s space-something 6dof input devices. It’s compatible with the
original 3dxsrv proprietary daemon provided by 3Dconnexion, and works
perfectly with any program that was written for the 3Dconnexion driver.

For more info on the spacenav project, visit: http://spacenav.sourceforge.net

2. Dependencies
In order to compile the spacenavd daemon, you’ll need the following:
* GNU C Compiler
* GNU make
* Xlib headers (optional)

You can compile the daemon without Xlib, but it won’t be compatible with
applications that where written for the original proprietary 3Dconnexion
driver (e.g. blender, maya, etc). The 3dxsrv compatibility interface needs to
go through the X window system.

3. Installation
If you have the dependencies installed, just run “./configure” and then
“make” to compile the daemon, and “make install”, to install it. The
default installation prefix is “/usr/local”. If you wish to install
somewhere else, you may pass –prefix=/whatever to the configure script.

4. Running spacenavd
If your system uses SysV init, then you may run the supplied “setup_init”
script, and everything should be set up to have spacenavd start automatically
during system startup. However, for now, you won’t have to reboot, just type
“/etc/init.d/spacenavd start” as root, to start the daemon immediately.

If your system uses BSD init (you can tell if you *don’t* have a series of
directories called rc0.d, rc1.d, and so on, in /etc), then you’ll have to
follow your init documentation and set this up yourself. You may be able to
use the provided init_script file as a starting point.

5. Configuration
The spacenavd daemon reads a number of options from the /etc/spnavrc file. If
that file doesn’t exist, then it uses default values for everything. You may
use the graphical spnavcfg program to interactively set any of these options.
The daemon should respond immediately to your changes, and also the
configuration file should be updated automatically.

6. Troubleshooting
If you’re having trouble running spacenavd, read the up to date FAQ on the
spacenav website: http://spacenav.sourceforge.net/faq.html

If you’re still having trouble, send a description of your problem to the
spacenav-users mailing list: spacenav-users@lists.sourceforge.net
along with a copy of your /var/log/spnavd.log and any other relevant
information.

7. License
This program is released under the terms of the GNU GPLv3, see COPYING for
details.

PROPRIETARY DRIVER: (We never did get the driver to work in Blender (but we think we know why – you have to recompile the plug file in a 64-bit Ubuntu – steps shown below) but we did get the driver working in Ubuntu see below – we ended up switching the open source version above but might just try to commercial driver again soon. Did you get it going?)

UBUNTU:

We downloaded and installed the proprietary driver 3dconnexion site: (As stated in their instructions)

The Blender page on 3dConnexion: http://www.3dconnexion.com/index.php?id=108

Plugin: http://www.3dconnexion.com/index.php?eID=sdl&ext=tx_iccsoftware&oid=27237638-d168-4cc6-bc67-4b1fe78de7c4&filename=3DxBlender2_47-Linux-i386.zip&ap1=PleaseSelect&ap2=&ap3=

We ran each of these commands using sudo:

sudo nautilus

Copy the 3dxware-linux-v1-2-11.tgz to /tmp

Copy and extract the install-3dxunix.sh file into /tmp using the terminal.

sudo tar xfz 3dxware-linux-v1-4-3.x86_64.tar.gz install-3dxunix.sh

Run the install script:

sudo ./install-3dxunix.sh

Then we had to install libmotif because the driver complained about not having the library libXm.so.3.

We used System > Administration > Synaptic Package Manager > search ” libmotif” to find and install the libraries.

START THE DRIVER:

Run the driver from the command line:

sudo /etc/3DxWare/daemon/3dxsrv -d usb

Here is what we saw:

UN-INSTALL THE DRIVER: (If you need to un-install here is how)

sudo aptitude remove 3dxunix

Since the driver was installed with a script rather than as a package, the above command will NOT remove the driver. Anyone know how to remove it?

We have an answer from the comments related to this post:

“Delete it.
And delete the corresponding line in the /etc/inittab.”

We take that to mean delete the directory

/etc/3DxWare

And this lines of code (at least for us):

3d:2345:respawn:/etc/3DxWare/daemon/3dxsrv -d usb </dev/null >/dev/null 2>&1

One can use sudo nautilus to navigate the files and delete them and then gedit to edit the inittab.

You will also need to delete the plugin in the .blend/plugins folder also and un-install libmotif using synaptic.

BLENDER: (We did not get our SpacePilot going in Blender using the Proprietary driver and switched to the open source version)

The next step is to get the proprietary driver going with blender:

Download the blender build from http://www.blenderbuilds.com/

Unzip the build.

Copy the 3DxNdofBlender.plugin folder to the plugin directory which is usually in home/user_name/.blend/plugins if you are using the Blender install from the Ubuntu (can require View > Show Hidden Files).

Double-clicked blender and you should be set to go…

64-bit Plug File: For us to get the device to work using 64-bit Ubuntu and Blender we needed the proprietary plug file recompiled using 64-bit Ubuntu.  This was the final key that enabled us to get this working with the open source driver and now we just need to try it on the proprietary version.

We want to thank RoboticGolem in the forums for helping us learn about the need for a 64-bit driver! Thank you, thank you, thank you – it has been a long haul.

How do you recompile the driver?

In the blender plugin zip from 3dconnexion (3DxBlender2_47-Linux-i386.zip) there is a file called 3dcnxplug-lin.c

it says to use the command cc 3dcnxplug-lin.c -Iintern/ghost -Wall -lc -shared -fPIC -fvisibility=hidden -o 3DxNdofBlender.plug to compile it (more or less). It’ll fail unless you have the GHOST_Types.h file from the blender source (I just put it in the same directory).

cc 3dcnxplug-lin.c -Iintern/ghost -Wall -lc -shared -fPIC -fvisibility=hidden -o 3DxNdofBlender.plug

http://www.blender.org/forum/viewtopic.php?p=78503

http://www.3dconnexion.com/forum/viewtopic.php?p=18401

http://blenderartists.org/forum/showthread.php?t=182325

BlenderBuilds.com: (Are they shutting down or is the 3Dconnexion taking over -shutting down is our best guess?)

http://www.blenderbuilds.com/2007/08/05/august-build-3dconnexion-with-a-prize/

ADDITIONAL RESOURCES:

http://www.arakhne.org/3dxware/index.html

Forum Article with readme files and other info: http://www.3dconnexion.com/forum/viewtopic.php?p=18109#18109

Interesting insights on getting the Open Source version going: http://www.3dconnexion.com/forum/viewtopic.php?p=13877#13877

POLL UPDATE: (Apparently they shut down our poll)

Add your vote to the poll we started: http://www.3dconnexion.com/forum/viewtopic.php?p=18109

TERMINAL:

If you need to find your device this command is suggested:

lshal | less

Followed by the “/” and the first few letters of the name of the device.

 /Space

Then:

Enter

That gave us this:

usb_device.product = '3Dconnexion Space Pilot 3D Mouse'  (string)

From Ubuntu

6 Comments
  1. 3Dconnexion permalink

    Delete it.
    And delete the corresponding line in the /etc/inittab.

  2. Got it? permalink

    I managed to get the plugin working with the official 2.49a on a 64bit system. The i386 plugin comes with source. compiled in on my system with the GHOSTS_Types.h from the blender source and the -fPIC(?) switch.

    Works great. tho it wont work with the 2.5 alpha.

  3. Is there any advantage between the proprietary driver versus the open-source?

  4. VitalBodies permalink

    So far my impression is that the Open Source Drive supports the basic movement of the puck and the commercial drive support many many more functions.
    The devices (3d controllers) range from some that are like and mouse to ones with built in screens and lot’s of buttons.

  5. Thanks !

    Following these instructions i can now use my Space Navigator with Blender 2.59 in Unbuntu 10.04 !

    As you know, 3Dconnexion drivers are not supported with Ubuntu
    Blender team just implement the support of these device, but i was only able to make it running in Windows.

    But now, with this open source driver, and your indtructions, it run.

    Gregoware (happy)

  6. Hanimann Lucian permalink

    thanks a lot for the introduction.
    I have problems executing:
    sudo make install
    in the spnavcfg-0.2.1 folder, I get the following error:

    install -d /usr/local/bin
    install -m 4775 spnavcfg /usr/local/bin/spnavcfg
    install: cannot stat `spnavcfg’: No such file or directory
    make: *** [install] Error 1

    can somebody help me?

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS