FreeSpacenav / spacenavd

Free user-space driver for 6-dof space-mice.
http://spacenav.sourceforge.net
GNU General Public License v3.0
279 stars 55 forks source link

Permission Error #99

Closed aguileraGit closed 6 months ago

aguileraGit commented 6 months ago

Hello. I was able to run config, make, and sudo make install. When I run the program as a regular user, I see permission errors in the logs. If I run it as root, I don't see these errors, but it complains about X11. I believe X11 blocked/disabled for root.

You reference a couple of test apps, but I can't find them anywhere.

diegoaguilera@ubuntuMain:~/Projects/spacenavd/spacenavd-1.2$ cat logFile.log 
Spacenav daemon 1.2
reading config file: /etc/spnavrc
failed to open config file /etc/spnavrc: No such file or directory. using defaults.
failed to open /dev/input/event5: Permission denied
failed to open /dev/input/mouse1: Permission denied
failed to open /dev/input/event4: Permission denied
failed to open /dev/input/mouse0: Permission denied
failed to open /dev/input/event3: Permission denied
failed to open /dev/input/event2: Permission denied
failed to open /dev/input/event1: Permission denied
failed to open /dev/input/event0: Permission denied
failed to open /dev/input/mice: Permission denied
failed to bind unix socket: /var/run/spnav.sock: Permission denied
trying to open X11 display ":10.0"
   XAUTHORITY=/home/diegoaguilera/.Xauthority
Using XSendEvent to send key events

I was able to resolve the Permission denied for all the /dev/input/ devices by adding a udev rule to give the user access. When I try to fix permissions on spnav.sock, that file does not exist. Any ideas?

jtsiomb commented 6 months ago

Yeah spacenavd is supposed to run as a system daemon, started by init and running as root.

To be able to connect to the X server, you need to arrange for the X authority file of the user who runs the X server to be available to root. Either symlink the user's X authority file to /root/.Xauthority, or set XAUTHORITY to point to the user's X authority file. See FAQ 10: https://spacenav.sourceforge.net/faq.html#faq10

Also if your X server is running as a bizzare display number like ":10.0" make sure DISPLAY is set accordingly in the spacenavd init script.

Edit: keep in mind that spavenavd does not need the X server at all. It attempts to connect to the X server only for two features: backwards compatibility with applications written to work with the 3dconnexion driver (3dxsrv), and the ability to synthesize fake keyboard events when buttons on the device are pressed. Applications written specifically for spacenavd, using the spacenavd UNIX domain socket protocol, will work either way, with or without spavenavd connected to the X server.