Difference between revisions of "3D Mouse"

From ArchWiki
Jump to: navigation, search
(Gentoo still use initscript so info in its wiki is not so useful anymore.)
(13 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[[Category:Hardware Compatibility List (English)]]
+
[[Category:Mice]]
 
+
''Also known as bats, flying mice, or wands, these devices generally function through ultrasound and provide at least three degrees of freedom. Probably the best known example would be 3DConnexion/Logitech's SpaceMouse from the early 1990s.'' - Wikipedia
== What is a 3D Mouse? ==
+
 
+
''"Also known as bats, flying mice, or wands, these devices generally function through ultrasound and provide at least three degrees of freedom. Probably the best known example would be 3DConnexion/Logitech's SpaceMouse from the early 1990s."'' - Wikipedia
+
  
 
For more information: http://www.3dconnexion.com/products/what-is-a-3d-mouse.html
 
For more information: http://www.3dconnexion.com/products/what-is-a-3d-mouse.html
 +
{{Note|The following instructions have been tested and proven to work on the most basic model (Space Navigator).}}
  
== Installation ==
+
=== Proprietary drivers ===
'''NOTE: The following instructions work only for 3DConnexions 3D mouse. The instructions have been tested and proven to work on the most basic model (space navigator).''' <br>
+
 
<br>
+
1. Plug your 3D mouse into your USB port. Use {{ic|lsusb}} to check if it was recognised
1. Insert mouse to USB port<br>
+
{{bc|1=$> lsusb
2. lsusb to confirm connection. Something like this should come up:
+
{{cli|1=$> lsusb
+
 
Bus 003 Device 002: ID 046d:c626 Logitech, Inc. 3Dconnexion Space Navigator 3D Mouse}}
 
Bus 003 Device 002: ID 046d:c626 Logitech, Inc. 3Dconnexion Space Navigator 3D Mouse}}
3. Install openmotif
+
 
{{cli|1=$> sudo pacman -S openmotif}}
+
2. Install {{Pkg|openmotif}} or if you need {{Pkg|lesstif}} (e.g. for {{Pkg|xpdf}}) you can just get the {{ic|libXm.so.4}} library from it:
4. Symlink libXm.so.4 to libXm.so.3
+
{{bc|1=$> sudo pacman -Sw openmotif # download openmotif to cache, do not install
{{cli|1=$> sudo ln -s /usr/lib/libXm.so.4 /usr/lib/libXm.so.3}}
+
$> tar xJOf /var/cache/pacman/pkg/openmotif-* usr/lib/libXm.so.4.0.3 > libXm.so.4
5. Compile (gcc PRGRM.c) this program:
+
$> sudo mv libXm.so.4 /usr/lib/libXm.so.4}}
<pre>
+
 
 +
3. Symlink {{ic|libXm.so.4}} to {{ic|libXm.so.3}}
 +
{{bc|1=$> sudo ln -s /usr/lib/libXm.so.4 /usr/lib/libXm.so.3}}
 +
 
 +
4. The driver has some problems to get the username from {{ic|/var/run/utmp}} and will output a "failed to get user" error.
 +
 
 +
To fix this problem compile the following program. It appends the given username to {{ic|/var/run/utmp}} in such a way that the driver can read it.
 +
{{hc|3dmouse.c|2=<nowiki>
 +
/* source: http://forums.gentoo.org/viewtopic-t-609224.html
 +
*        http://www.3dconnexion.com/forum/viewtopic.php?t=1039
 +
*/
 
#include <stdio.h>
 
#include <stdio.h>
 
#include <string.h>
 
#include <string.h>
Line 41: Line 47:
 
   endutxent();
 
   endutxent();
 
}  
 
}  
</pre>
+
</nowiki>}}
source: http://forums.gentoo.org/viewtopic-t-609224.html?sid=6c70ce10f37a57d9a4f341e36149df5b <br>
+
{{bc|1=$> gcc 3dmouse.c -o 3dmouse
6. Run a.out to user root
+
$> sudo ./3dmouse root}}
{{cli|1=$> sudo ./a.out root}}
+
 
7. Download linux drivers to /tmp from here: http://www.3dconnexion.com/service/drivers.html<br>
+
5. Download the linux drivers to {{ic|/tmp}} from here: http://www.3dconnexion.com/service/drivers.html
8. Run tar xfz 3dxware-linux-v1-5-2.i386.tar.gz install-3dxunix.sh<br>
+
 
9. Run sudo ./install-3dxunix.sh and follow instructions<br>
+
6. Unpack the install script and run it
10. Your output should look something like this:
+
{{bc|1=$> tar xfz 3dxware-linux-v1-5-2.i386.tar.gz install-3dxunix.sh
{{cli|1=
+
$> sudo ./install-3dxunix.sh
$>> sudo ./install-3dxunix.sh
+
 
Password:
 
Password:
  
 +
<nowiki>
 
This installs 3DxWareUnix V1.5.2 on this machine. Continue? (y/n) [y]
 
This installs 3DxWareUnix V1.5.2 on this machine. Continue? (y/n) [y]
 
y
 
y
 
  
 
  Choose one of the following platforms:
 
  Choose one of the following platforms:
Line 67: Line 72:
 
Please enter your choice (1-5)[4]:
 
Please enter your choice (1-5)[4]:
 
4
 
4
 
  
 
Installing files for 3DxWare for Unix / linux......
 
Installing files for 3DxWare for Unix / linux......
Line 114: Line 118:
 
Please start the driver manually. [/etc/3DxWare/daemon/3dxsrv -d <port>]
 
Please start the driver manually. [/etc/3DxWare/daemon/3dxsrv -d <port>]
  
''****************************************************************''
+
****************************************************************
 
     For testing purposes you can find the demos
 
     For testing purposes you can find the demos
xcube and xvalues at /tmp
+
                      xcube and xvalues at /tmp
''****************************************************************''
+
****************************************************************
 +
</nowiki>}}
 +
NOTE: I chose not to run the driver everytime I login.
 +
 
 +
7. You can run the driver manually by calling it like this (for USB version):
 +
{{bc|1=$> sudo /etc/3DxWare/daemon/3dxsrv -d USB}}
 +
 
 +
8. You should now have a working 3D mouse in Arch Linux!
 +
You can test it by extracting the demos from the driver archive.
 +
{{bc|1=$> tar xfz 3dxware-linux-v1-5-2.i386.tar.gz xcube
 +
$> ./xcube}}
 +
 
 +
=== Open Source Drivers ===
 +
There exists also an open source driver for 3Dconnexion devices maintained by the spacenav project.
 +
Unfortunately the list of supported applications is very short.
 +
Actually there is only one major software supporting the spacenav driver, namely the 3D creation suite Blender.
 +
For it to work three things must be fulfilled
 +
# The device must be recognized by the kernel as input device
 +
# The spacenavd daemon must be running
 +
# The application must be compiled with spacenav support. (community/{{Pkg|blender}} isn't)
 +
 
 +
The first requirement should be fulfilled automatically after plugging in the device.
 +
It can be checked by looking if the device is listed in {{ic|/proc/bus/input/devices}} e.g. by
 +
{{bc|1=$> grep 3Dconnexion /proc/bus/input/devices
 +
N: Name="3Dconnexion SpaceNavigator"}}
 +
 
 +
For the second point install {{AUR|libspnav}} and {{AUR|spacenavd}} from AUR.
 +
For testing it's a good idea to start the daemon on foreground mode. The output should look similar to this:
 +
{{bc|1=$> sudo spacenavd -v -d
 +
Spacenav daemon 0.5
 +
Device detection, parsing /proc/bus/input/devices
 +
using device: /dev/input/event21
 +
device name: 3Dconnexion SpaceNavigator
 +
trying to open X11 display ":0"
 +
  XAUTHORITY=/home/user/.Xauthority
 
}}
 
}}
<br>
+
If it works you can simply shut down the daemon by hitting CTRL-C and run it using {{ic|sudo /etc/rc.d/spacenavd start}}.
NOTE: I chose not to run the driver everytime I login.<br>
+
On a systemd-only system the following service script can be used to start the daemon with {{ic|sudo systemctl start spacenavd.service}}
11. You can run the driver manually by calling it like this (for USB version):
+
{{hc|1=/etc/systemd/system/spacenavd.service|2=
{{cli|1=$>> /etc/3DxWare/daemon/3dxsrv -d USB}}<br>
+
[Unit]
12. You should now have a working 3D mouse in Arch Linux!
+
Description=Userspace Daemon of the spacenav driver.
 +
 
 +
[Service]
 +
Type=forking
 +
PIDFile=/var/run/spnavd.pid
 +
ExecStart=/usr/bin/spacenavd
 +
 
 +
[Install]
 +
WantedBy=multi-user.target}}
 +
 
 +
Now everything is up and running and every supported application should be able to use the 3D Mouse.
 +
 
 +
==== Rebuild Blender with spacenav support ====
 +
Unfortunately the {{Pkg|blender}} package in the community repository is not compiled with spacenav support.
 +
So you have to compile it yourself which is very easy
 +
{{bc|1=$> yaourt -S libspnav # blender will automatically build with NDOF(=spacenav) support when libspnav is installed
 +
$> yaourt -G blender
 +
$> cd blender
 +
$> makepkg
 +
$> sudo pacman -U blender-*.tar.xz
 +
}}
 +
 
 +
Now you can fire up blender and test your 3D Mouse.
 +
{{bc|1=$> blender
 +
ndof: using SpaceNavigator}}
  
== More Infformation ==
+
== See also ==
[http://www.3dconnexion.com/forum/viewforum.php?f=22 3dconnexion linux forum]<br>
+
* [http://www.3dconnexion.com/forum/viewforum.php?f=22 3dconnexion linux forum]
[http://www.3dconnexion.com/forum/viewtopic.php?t=1039 Source of C program used]<br>
+
* [http://www.3dconnexion.com/forum/viewtopic.php?t=1039 Source of C program used]
[http://www.3dconnexion.com/forum/viewtopic.php?t=1757 Information about libXm.so.4 and libXm.so.3]
+
* [http://www.3dconnexion.com/forum/viewtopic.php?t=1757 Information about libXm.so.4 and libXm.so.3]
 +
* [http://spacenav.sourceforge.net/ Website of the open source driver spacenav]
 +
* [http://spacemice.wikidot.com/ Community Wiki about Spacemice]

Revision as of 02:15, 18 May 2013

Also known as bats, flying mice, or wands, these devices generally function through ultrasound and provide at least three degrees of freedom. Probably the best known example would be 3DConnexion/Logitech's SpaceMouse from the early 1990s. - Wikipedia

For more information: http://www.3dconnexion.com/products/what-is-a-3d-mouse.html

Note: The following instructions have been tested and proven to work on the most basic model (Space Navigator).

Proprietary drivers

1. Plug your 3D mouse into your USB port. Use lsusb to check if it was recognised

$> lsusb
Bus 003 Device 002: ID 046d:c626 Logitech, Inc. 3Dconnexion Space Navigator 3D Mouse

2. Install openmotif or if you need lesstif (e.g. for xpdf) you can just get the libXm.so.4 library from it:

$> sudo pacman -Sw openmotif # download openmotif to cache, do not install
$> tar xJOf /var/cache/pacman/pkg/openmotif-* usr/lib/libXm.so.4.0.3 > libXm.so.4
$> sudo mv libXm.so.4 /usr/lib/libXm.so.4

3. Symlink libXm.so.4 to libXm.so.3

$> sudo ln -s /usr/lib/libXm.so.4 /usr/lib/libXm.so.3

4. The driver has some problems to get the username from /var/run/utmp and will output a "failed to get user" error.

To fix this problem compile the following program. It appends the given username to /var/run/utmp in such a way that the driver can read it.

3dmouse.c
/* source: http://forums.gentoo.org/viewtopic-t-609224.html
 *         http://www.3dconnexion.com/forum/viewtopic.php?t=1039
 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <utmpx.h>

int main(int argc, char ** argv) {
  if (argc != 2) {
    fprintf(stderr, "Need a name to put in the structure\n");
    exit(1);
  }
  struct utmpx u;
  memset(&u, 0, sizeof(u));
  u.ut_type = USER_PROCESS;
  u.ut_pid = getpid();
  strcpy(u.ut_id, ":0");
  strcpy(u.ut_line, ":0");
  strcpy(u.ut_user, argv[1]);
  setutxent();
  pututxline(&u);
  endutxent();
} 
$> gcc 3dmouse.c -o 3dmouse
$> sudo ./3dmouse root

5. Download the linux drivers to /tmp from here: http://www.3dconnexion.com/service/drivers.html

6. Unpack the install script and run it

$> tar xfz 3dxware-linux-v1-5-2.i386.tar.gz install-3dxunix.sh
$> sudo ./install-3dxunix.sh
Password:


This installs 3DxWareUnix V1.5.2 on this machine. Continue? (y/n) [y]
y

 Choose one of the following platforms:

  1.  HP-UX
  2.  Solaris
  3.  AIX 5
  4.  Linux
  5.  Exit

Please enter your choice (1-5)[4]:
4

Installing files for 3DxWare for Unix / linux......

Uninstalling a running driver. Please wait ...
Done.

Converting default configs V5.x to V5.3.
(User configs will be converted when used)
Please wait a moment...
Converting configs... found 27 configurations
Configuration file             Configuration name       Version Status
/etc/3DxWare/UGSNX2_01.scg     ("UGS NX 2 config 01      ") 5.3 Ok.
/etc/3DxWare/4DNav.scg         ("4D Navigator            ") 5.3 Ok.
/etc/3DxWare/UGSNX5_02.scg     ("UGS NX 5 config 02      ") 5.3 Ok.
/etc/3DxWare/CatiaV5_02.scg    ("CATIA V5 config 02      ") 5.3 Ok.
/etc/3DxWare/Maya2011.scg      ("Maya 2011               ") 5.3 Ok.
/etc/3DxWare/CatiaV4_01.scg    ("CATIA V4                ") 5.3 Ok.
/etc/3DxWare/Patran_01.scg     ("Patran                  ") 5.3 Ok.
/etc/3DxWare/UGSNX4_01.scg     ("UGS NX 4 config 01      ") 5.3 Ok.
/etc/3DxWare/Pr(...)ire_02.scg ("ProE Wildfire config 02 ") 5.3 Ok.
/etc/3DxWare/Pr(...)ire_01.scg ("ProE Wildfire config 01 ") 5.3 Ok.
/etc/3DxWare/UGSNX2_02.scg     ("UGS NX 2 config 02      ") 5.3 Ok.
/etc/3DxWare/CatiaV5_03.scg    ("CATIA V5 config 03      ") 5.3 Ok.
/etc/3DxWare/UGSNX3_02.scg     ("UGS NX 3 config 02      ") 5.3 Ok.
/etc/3DxWare/default_10.scg    ("Driver Protocol 1.0     ") 5.3 Ok.
/etc/3DxWare/CADDS_R14.scg     ("CADDS5 R14 +            ") 5.3 Ok.
/etc/3DxWare/CatiaV5_01.scg    ("CATIA V5 config 01      ") 5.3 Ok.
/etc/3DxWare/DMUNav.scg        ("DMU Navigator           ") 5.3 Ok.
/etc/3DxWare/UGSNX4_02.scg     ("UGS NX 4 config 02      ") 5.3 Ok.
/etc/3DxWare/Enovia_VPM.scg    ("Enovia VPM              ") 5.3 Ok.
/etc/3DxWare/UGSNX5_01.scg     ("UGS NX 5 config 01      ") 5.3 Ok.
/etc/3DxWare/ICEM_MED.scg      ("ICEM MED                ") 5.3 Ok.
/etc/3DxWare/CADDS_R13.scg     ("CADDS5 -R13             ") 5.3 Ok.
/etc/3DxWare/DVise.scg         ("DVise                   ") 5.3 Ok.
/etc/3DxWare/Op(...)alizer.scg ("Optegra Visualizer      ") 5.3 Ok.
/etc/3DxWare/UGSNX3_01.scg     ("UGS NX 3 config 01      ") 5.3 Ok.
/etc/3DxWare/IDEAS_01.scg      ("IDEAS                   ") 5.3 Ok.
/etc/3DxWare/default.scg       ("Any Application         ") 5.3 Ok.

Done.

Do you want 3DxWareUnix being started with every login (from the /etc/inittab)? (y/n) [y]
n

Please start the driver manually. [/etc/3DxWare/daemon/3dxsrv -d <port>]

****************************************************************
    For testing purposes you can find the demos
                      xcube and xvalues at /tmp
****************************************************************

NOTE: I chose not to run the driver everytime I login.

7. You can run the driver manually by calling it like this (for USB version):

$> sudo /etc/3DxWare/daemon/3dxsrv -d USB

8. You should now have a working 3D mouse in Arch Linux! You can test it by extracting the demos from the driver archive.

$> tar xfz 3dxware-linux-v1-5-2.i386.tar.gz xcube
$> ./xcube

Open Source Drivers

There exists also an open source driver for 3Dconnexion devices maintained by the spacenav project. Unfortunately the list of supported applications is very short. Actually there is only one major software supporting the spacenav driver, namely the 3D creation suite Blender. For it to work three things must be fulfilled

  1. The device must be recognized by the kernel as input device
  2. The spacenavd daemon must be running
  3. The application must be compiled with spacenav support. (community/blender isn't)

The first requirement should be fulfilled automatically after plugging in the device. It can be checked by looking if the device is listed in /proc/bus/input/devices e.g. by

$> grep 3Dconnexion /proc/bus/input/devices
N: Name="3Dconnexion SpaceNavigator"

For the second point install libspnavAUR and spacenavdAUR from AUR. For testing it's a good idea to start the daemon on foreground mode. The output should look similar to this:

$> sudo spacenavd -v -d
Spacenav daemon 0.5
Device detection, parsing /proc/bus/input/devices
using device: /dev/input/event21
device name: 3Dconnexion SpaceNavigator
trying to open X11 display ":0"
   XAUTHORITY=/home/user/.Xauthority

If it works you can simply shut down the daemon by hitting CTRL-C and run it using sudo /etc/rc.d/spacenavd start. On a systemd-only system the following service script can be used to start the daemon with sudo systemctl start spacenavd.service

/etc/systemd/system/spacenavd.service
[Unit]
Description=Userspace Daemon of the spacenav driver.

[Service]
Type=forking
PIDFile=/var/run/spnavd.pid
ExecStart=/usr/bin/spacenavd

[Install]
WantedBy=multi-user.target

Now everything is up and running and every supported application should be able to use the 3D Mouse.

Rebuild Blender with spacenav support

Unfortunately the blender package in the community repository is not compiled with spacenav support. So you have to compile it yourself which is very easy

$> yaourt -S libspnav # blender will automatically build with NDOF(=spacenav) support when libspnav is installed
$> yaourt -G blender
$> cd blender
$> makepkg
$> sudo pacman -U blender-*.tar.xz

Now you can fire up blender and test your 3D Mouse.

$> blender
ndof: using SpaceNavigator

See also