18#define LOG (&LOG_NDOF_UNIX)
26 else if (spnav_open() != -1) {
32#define MAX_LINE_LENGTH 100
35 FILE *command_output = popen(
"lsusb | grep '046d:\\|256f:'",
"r");
39 ushort vendor_id = 0, product_id = 0;
40 if (sscanf(line,
"Bus %*d Device %*d: ID %hx:%hx", &vendor_id, &product_id) == 2) {
46 pclose(command_output);
71#define USE_FINISH_GLITCH_WORKAROUND
74#ifdef USE_FINISH_GLITCH_WORKAROUND
87# define MOTION_TEST_IDLE_MS 100
92 bool anyProcessed =
false;
97#ifdef USE_FINISH_GLITCH_WORKAROUND
98 bool motion_test =
false;
101 while (spnav_poll_event(&
e)) {
103 case SPNAV_EVENT_MOTION: {
106 const int t[3] = {int(
e.motion.x), int(
e.motion.y), int(-
e.motion.z)};
107 const int r[3] = {int(-
e.motion.rx), int(-
e.motion.ry), int(
e.motion.rz)};
111#ifdef USE_FINISH_GLITCH_WORKAROUND
117 case SPNAV_EVENT_BUTTON:
125#ifdef USE_FINISH_GLITCH_WORKAROUND
134 const int v[3] = {0, 0, 0};
149#undef USE_FINISH_GLITCH_WORKAROUND
#define CLOG_INFO(clg_ref, level,...)
#define GHOST_ASSERT(x, info)
static uint64_t motion_test_prev_time
static bool motion_test_prev
#define MOTION_TEST_IDLE_MS
static const char * spnav_sock_path
static CLG_LogRef LOG_NDOF_UNIX
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned long long int uint64_t
bool available() override
~GHOST_NDOFManagerUnix() override
GHOST_NDOFManagerUnix(GHOST_System &)
void updateTranslation(const int t[3], uint64_t time)
GHOST_NDOFManager(GHOST_System &)
void updateButtonRAW(int button_number, bool press, uint64_t time)
void updateRotation(const int r[3], uint64_t time)
bool setDevice(unsigned short vendor_id, unsigned short product_id)