Some information about Spacenav

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
rockn
Posts: 1586
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Some information about Spacenav

Postby rockn » Sun Dec 14, 2014 12:43 pm

Hi everyone !
A new version of free spacenav is available.(after 4 years :shock: ). Last days I compile and install this last version on my Ubuntu system. It's work as always with FreeCAD.
But I still need to run this to FreeCAD detect spacenavigator.

Code: Select all

sudo /etc/init.d/spacenavd restart
I took contact with freespacenav dev, he is going to see if the needed of restart spacenav daemon can be fixed.
He also say to me that the command :

Code: Select all

sudo xhost +
should not be needed on any version of spacenav.
But instead, we have to copy the user's .Xauthority file in root's home

Code: Select all

sudo cp ~/.Xauthority /root/
If anyone having this trouble, could he test this if it's work. So we can change the wiki, because xhost + is a command with some security risk.
I can't really test since I don't need it either with new spacenav version.

I have another tips :
If you don't want to run the command to restart the daemon after each login :
you can create a script like this

Code: Select all

#!/bin/sh
echo PASSWORD | sudo -S /etc/init.d/spacenavd restart
exit 0
Change password with your sudo passaword.
Then add this command on starting application :
sh -c "/path/to/the/script.sh"
It's not very safe because the password is in plain text ...
Formations et tutoriels FreeCAD en Français, soutenez moi : https://www.tipeee.com/formations-freecad
User avatar
tanderson69
Posts: 1500
Joined: Thu Feb 18, 2010 1:07 am

Re: Some information about Spacenav

Postby tanderson69 » Sun Dec 14, 2014 3:36 pm

rockn wrote:He also say to me that the command :

Code: Select all

sudo xhost +
should not be needed on any version of spacenav.
But instead, we have to copy the user's .Xauthority file in root's home

Code: Select all

sudo cp ~/.Xauthority /root/
It's been a while, but it seems like I remember the .Xauthority procedure wasn't working on kubuntu after some version. Just FYI

I screwed up when I did the spaceball support for freecad. I should have never used the magellan xwindow protocol. It was/is obsolete and should be for legacy support only.
galou_breizh
Posts: 259
Joined: Wed Sep 15, 2010 9:38 am

Re: Some information about Spacenav

Postby galou_breizh » Mon Dec 15, 2014 8:41 pm

Hi,

I managed to have the spacenav working at startup on Ubuntu 14.04. Here is my setup, though I don't like it:
I added two lines at the beginning the init script "/etc/init.d/spacenavd"

Code: Select all

export XAUTHORITY=/home/gael/.Xauthority
export DISPLAY=:0
where gael is my user name (its presence there is the reason why I don't like my setup).

As stated in the man page, you have to add a command for the spacenav daemon to send x events:
add the file "/etc/X11/Xsession.d/90-spnav_ctl" with the content

Code: Select all

/usr/bin/spnavd_ctl x11  start
Hope this helps,
Gaël
User avatar
rockn
Posts: 1586
Joined: Wed Sep 28, 2011 10:39 am
Location: Toulouse, France
Contact:

Re: Some information about Spacenav

Postby rockn » Mon Dec 15, 2014 11:15 pm

Interesting, thanks for sharing !
Formations et tutoriels FreeCAD en Français, soutenez moi : https://www.tipeee.com/formations-freecad
User avatar
bejant
Posts: 5950
Joined: Thu Jul 11, 2013 3:06 pm

Re: Some information about Spacenav

Postby bejant » Sat Jan 24, 2015 8:38 am

galou_breizh wrote:I managed to have the spacenav working at startup on Ubuntu 14.04. Here is my setup, though I don't like it:
I added two lines at the beginning the init script "/etc/init.d/spacenavd"
Gaël, Thanks for sharing indeed! It's nice to have my Spaceball working in FreeCAD automatically now.
Edit 2015-01-24: It starts automatically only right after after booting, but not when I logout and log back in. I'll have to take another look...
dublya
Posts: 6
Joined: Wed Jan 30, 2019 5:43 pm

Re: Some information about Spacenav startup on elementary juno

Postby dublya » Wed Jan 30, 2019 6:08 pm

Posting for anyone who would like to use spacenav with freecad on elementary juno.

I first followed the docs here: https://www.freecadweb.org/wiki/index.p ... ut_devices

To install spacenav on elementary juno:

1. sudo apt-get install spacenavd
2. sudo cp ~/.Xauthority /root/
3. sudo /usr/bin/spnavd_ctl x11 stop
4. sudo /usr/bin/spnavd_ctl x11 start

Then do these steps every time you boot up and login:

1. sudo xhost +
2. sudo /etc/init.d/spacenavd restart

What follows below is how to start spacenav on startup, so that you don't have to issue the commands every time.

( I brought this over from where I originally posted the question : https://elementaryos.stackexchange.com/ ... 8141#18141 )

It turned out I did not actually need to use sudo with these commands. That said, something I did, tho I can't re-create it, did allow me to issue the commands preceeded by sudo. I ran the script with the sudo commands and was prompted by a desktop dialogue box to enter my password. If anyone can re-create, this may solve the original question.

What I did was to save the 2 commands (without sudo) in a bash script in my home folder. Then I gave it permissions to be executed by me and my group. Then, in elementary juno, I went to System Settings > Applications > Startup and clicked the + in bottom left to add the script.

This action creates a file in ~/.config/autostart/ with basic info that results in something very similar to my original screenshot, named Custom Command and with a stock icon. I was able to clean up the look by editing basic info in this file, like name, and adding an icon in ~/.local/share/icons/hicolor/128x128/apps/ called spacenavd.png.

Here is how it looks now:

Image

Here is the spacenavd.sh file in my home folder

Code: Select all

#! /bin/bash
    
xhost +
/etc/init.d/spacenavd restart
The permissions on the script

Image


The dekstop file at ~/.config/autostart/ which I renamed spacenavd.desktop

Code: Select all

[Desktop Entry]
Name[en_US]=Spacenav
Comment[en_US]=3D Controller
Exec=./spacenavd.sh
Icon=spacenavd
X-GNOME-Autostart-enabled=true
Type=Application
And the spacenavd icon ~/.local/share/icons/hicolor/128x128/apps/spacenavd.png

Image
galou_breizh
Posts: 259
Joined: Wed Sep 15, 2010 9:38 am

Re: Some information about Spacenav

Postby galou_breizh » Thu Jan 31, 2019 9:34 am

Can you please specify your setup? I can't get it working on Ubuntu 18 with FreeCAD v0.18.
dublya wrote: 2. sudo cp ~/.Xauthority /root/
On Ubuntu 18.04, there is no file `~/.Xauthority`, the correct file, I think, is `/run/user/$(id -u)/gdm/Xauthority`.
dublya wrote: 3. sudo /usr/bin/spnavd_ctl x11 stop
4. sudo /usr/bin/spnavd_ctl x11 start
This is useless if you run `sudo /etc/init.d/spacenavd restart` afterwards which kills the daemon.
dublya wrote: 2. sudo /etc/init.d/spacenavd restart
A more modern version of this command is `sudo systemctl restart spacenavd`.

What I need to do on Ubuntu 18.04 is to deactivate xinput for the device (I have an older SpacePilot but I guess this is the same with others) because it would otherwise be treated as a mouse.:

Code: Select all

Section "InputClass"
   Identifier         "SpaceNav"
   MatchProduct       "3Dconnexion SpacePilot"
   Option             "Ignore" "on"
EndSection
I did manage to have to work with the official 3dconnexion driver, which has the advantage that it can be launched as normal user. I didn't post anything about it yet because last time I tried it didn't work :(

Gaël

OS: Ubuntu 18.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15711 (Git)
Build type: Release
Branch: master
Hash: 5caae5f430237a73cd17e283d45b3ac9ab005feb
Python version: 2.7.15rc1
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
dublya
Posts: 6
Joined: Wed Jan 30, 2019 5:43 pm

Re: Some information about Spacenav

Postby dublya » Thu Jan 31, 2019 4:37 pm

here is my setup on a model A1398 macbook pro 2012

OS: elementary OS 5.0 Juno
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15697 (Git) AppImage
Build type: Release
Branch: master
Hash: dedaa807629ab25cf32977d30bf7610f1346aff7
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

Screenshot from 2019-01-31 11-34-00.png
Screenshot from 2019-01-31 11-34-00.png (201.23 KiB) Viewed 428 times
galou_breizh
Posts: 259
Joined: Wed Sep 15, 2010 9:38 am

Re: Some information about Spacenav

Postby galou_breizh » Fri Feb 01, 2019 9:53 pm

Thanks for the info.

Could you please help us (me) making this work by answering the few questions I had?

Thanks a lot!
Gaël