3D Mouse Linux

   3987   13   4
User Avatar
Member
5 posts
Joined: May 2020
Offline
Hi, hoping someone can help.
I have my 3Dconnexion Space Navigator working in Ubuntu 20.04 with Blender but it doesn’t work in Houdini. I did a fresh install of Ubuntu , installed spacenavd and it worked straight away in Blender but I cant get it working for Houdini even after following the sidefx 3d mouse instructions. Has anyone got this working in Linux ? I’m happy to switch distros if necessary.

Thanks in advance
rOB
User Avatar
Member
11 posts
Joined: July 2020
Offline
I have the same issue as you. I´m on Manjaro (Arch). The spacenavd daemon is running and my space mouse is registered as an input device. Blender recognizes it but Houdini doesn´t.
User Avatar
Member
11 posts
Joined: July 2020
Offline
This appears to be the official guide:
https://www.sidefx.com/docs/houdini/basics/3dmouse [www.sidefx.com]

The guide recommends always using the latest version of Spacenav (currently 0.8).

However, the guide also says it was tested on an older revision of Spacenav in an SVN repository which apparently no longer exists, so I have a bad feeling about this.

The guide says 0.6 had bugs, which means it was likely tested on either 0.7 or 0.7.1, unless "revision 192" was a daily build.
User Avatar
Member
11 posts
Joined: July 2020
Offline
The Spacenav source repository is here:
https://github.com/FreeSpacenav/spacenavd [github.com]

The README states the following:
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. maya, houdini, etc). The 3dxsrv compatibility interface needs to communicate with clients through the X window system. Programs designed to work with the alternative spacenavd-specific interface however (e.g. blender) will work fine even when spacenavd is built without X11 support.

So I assume Blender is special and has direct support for spacenavd while Houdini communicates through a different compatibility route, which is not currently working with my installed version of spacenavd.
User Avatar
Member
11 posts
Joined: July 2020
Offline
Attempting to run spnavd_ctl, which SideFX lists as a step in their guide (above), produces the following error:
You must have an X server running before starting up spacenavd-X11 events.

So if this program is a requirement for the X11 compatibility interface to work, this could be the reason for Houdini being unable to communicate with the space mouse.
Edited by kimsnarf - May 3, 2021 12:45:06
User Avatar
Member
11 posts
Joined: July 2020
Offline
It turns out that spnavd_ctlis just a bash script, which runs xdpyinfoto look for an X server. After installing xdpyinfothe script still complains with the same error, but this time because it´s looking for a display at ":0". My display is apparently at ":1", for some reason, according to xdpyinfo. I tried updating spnavd_ctlto use ":1" instead, causing it to run successfully, but with Houdini still not recognizing the space mouse. It might be an assumption that the display is at ":0" so I must figure out how to change this.
User Avatar
Member
11 posts
Joined: July 2020
Offline
Spacenav indeed assumes that the display is at ":0". Looking at /var/log/spnavd.log, after starting the daemon, the log says:
failed to open X11 display ":0.0"

This string leads back to the source file src/proto_x11.ccompiled in spacenavd, with the code:
/* if the server started from init, it probably won't have a DISPLAY env var
 * so let's add a default one.
 */
if(!getenv("DISPLAY")) {
    putenv("DISPLAY=:0.0");
}

So, basically, when the DISPLAY environment variable is not set for the daemon, spacenavdassumes ":0.0", which is wrong in my case.
User Avatar
Member
11 posts
Joined: July 2020
Offline
Success! I have my space mouse working in Houdini now!

What I had to do was set the DISPLAY environment variable to ":1" for the daemon.

Since I´m on Manjaro (Arch), which uses systemdinstead of init.d, I had to add the following line to my /etc/systemd/system/spacenavd.serviceunder the section [Service]:
Environment=DISPLAY=:1

And, of course, the spnavd_ctlprogram must be running in addition to the spacenavddaemon.
User Avatar
Member
5 posts
Joined: May 2020
Offline
This works on Rocky Don't forget to update the display in the /usr/local/bin/spnavd_ctl file

Steps to get this working on Rocky 8

Follow the install from the latest https://github.com/FreeSpacenav/spacenavd/tree/master [github.com]

copy the example service file over to /etc/systemd/system/

sudo cp contrib/systemd/spacenavd.service /etc/systemd/system/

get the current display
[rob@customer bin]$ who
rob      :1           2025-02-05 09:59 (:1)

edit /etc/systemd/system/spacenavd.service and update with the correct display (:1 in my case)
[Service]
Type=forking
PIDFile=/var/run/spnavd.pid
ExecStart=/usr/local/bin/spacenavd
StandardError=syslog
Environment=DISPLAY=:1

Edit /usr/local/bin/spnavd_ctl
.....
if [ "$2" = 'start' ]; then
	# check to see there is a local X server running.
	DISPLAY=":1"
.....

Add the service and start it all
sudo systemctl enable spacenavd
sudo systemctl start spacenavd
/usr/local/bin/spnavd_ctl x11 start -v


rOb
Edited by insanerob - Feb. 5, 2025 11:28:24
User Avatar
Member
11 posts
Joined: July 2020
Offline
I ran into a new problem on Fedora.

  1. When spacenavdis started as root (as a service), it can't access the user X server, and Houdini can't talk to it ("failed to open X11 display"in /var/log/spnavd.log).
  2. If I start spacenavdmanually, it works fine. But I want it running as a service.
  3. If I start spacenavdas a user service, it fails due to lacking permission to (create?) the socket file in /var/run/spnav.sock.

The solution I found is to keep running spacenavdas a service (root), but give root access to the user X server. To do this on each login I added the following to ~/.zlogin:
xhost +si:localuser:root > /dev/null

If using bash (default), you would probably add it to ~/.profileinstead.

This is not ideal. If running as a user service instead it would have access to the X server, and it could delay starting up until the X server is actually running (unlike the root service, which fails to connect a couple of times). But I have not found a working solution for that, and would probably need to modify the spacenavdcode to handle the socket file differently.
Edited by kimsnarf - Feb. 8, 2025 01:28:15
User Avatar
Staff
653 posts
Joined: Aug. 2019
Offline
If it's started through systemd, you could try telling it to run the service as your user. You can add User=usernameunder [Service]in the service unit definition.
Edited by johnmather - Feb. 8, 2025 20:55:18
User Avatar
Member
11 posts
Joined: July 2020
Offline
johnmather
If it's started through systemd, you could try telling it to run the service as your user. You can add User=usernameunder [Service]in the service unit definition.

Thanks for the tip! But this has the same result as running the service as a user service. That is, the user lacks permission to the socket file in a root-owned directory. But strangely it works when I run spacenavdmanually as the same user.
User Avatar
Member
3 posts
Joined: Jan. 2020
Offline
I'm having a similar issues (Arch, official libspnav and spacenavd packages) where when using sudo systemctl, space mouse works in other programs (blender) but not houdini.

Killing that daemon and running "spacenavd", space mouse works in houdini but not other programs.

Killing that daemon (having two running breaks it) and running "sudo spacenavd" allows the space mouse to work in all programs.



kimsnarf
xhost +si:localuser:root > /dev/null

I couldn't get this to work (I auto-login to wayland and switch to x11 for houdini when needed, not sure if that would break it) so for the time being, I am just running "sudo spacenavd" manually on system start.
: )
User Avatar
Member
3 posts
Joined: March 2021
Offline
for houdini on arch instead of switching to x11 shell you can use Xephyr to run it in a wayland window
I have Xephyr setup minimally using openbox as window manager and need to add some parameters so houdini will launch,
made a script so it launches a hyprland window with x11 xephyr inside and houdini fullscreen

to get spacenavd to work on wayland/hyprland I compiled it to not use x11 dependencies, and use systemd to launch it like normal, works for blender and prusaslicer.

Programs that use legacy x11 spacenavd integration, seem to need an x11 root window, so i just stop the spacenavd systemd service when launching houdini in xephyr and start a normal spacenavd inside xephyr first, which also gives error on the socket but makes spacenavd available for houdini anyway.

Then a cleanup script to close xephyr and pkill spacenavd-x11 (the regular spacenavd) and restart the systemd spacenavd (the headless non x11 one) which makes it available for wayland again.

Also had some issues with licenseserver and hserver so the houdini launch script checks if they are running and fires them up if not.
  • Quick Links