Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-04-22 11:14:30 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-04-22 11:14:30 +0300
commit31632e7f74423aec01d64e3964200a03a70491d8 (patch)
treeb0a0a21dbb13e532aafd8d32e92d9ea5f8f3c836 /intern
parent599b7ad13b37ab8f2835619768b23370dfb2d661 (diff)
NDof device: Check for socket exists before connecting to spnavd
This allows us to get rid of annoying and misleading error printed to the console about being unable to connect to something.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_NDOFManagerUnix.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp b/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
index df516357c9e..8fea2a0261b 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
@@ -28,13 +28,22 @@
#include <spnav.h>
#include <stdio.h>
+#include <unistd.h>
+#define SPNAV_SOCK_PATH "/var/run/spnav.sock"
GHOST_NDOFManagerUnix::GHOST_NDOFManagerUnix(GHOST_System& sys)
: GHOST_NDOFManager(sys),
m_available(false)
{
- if (spnav_open() != -1) {
+ if (access(SPNAV_SOCK_PATH, F_OK) != 0) {
+#ifdef DEBUG
+ /* annoying for official builds, just adds noise and most people don't own these */
+ puts("ndof: spacenavd not found");
+ /* This isn't a hard error, just means the user doesn't have a 3D mouse. */
+#endif
+ }
+ else if (spnav_open() != -1) {
m_available = true;
/* determine exactly which device (if any) is plugged in */
@@ -55,13 +64,6 @@ GHOST_NDOFManagerUnix::GHOST_NDOFManagerUnix(GHOST_System& sys)
pclose(command_output);
}
}
- else {
-#ifdef DEBUG
- /* annoying for official builds, just adds noise and most people don't own these */
- puts("ndof: spacenavd not found");
- /* This isn't a hard error, just means the user doesn't have a 3D mouse. */
-#endif
- }
}
GHOST_NDOFManagerUnix::~GHOST_NDOFManagerUnix()