25 else if (spnav_open() != -1) {
31#define MAX_LINE_LENGTH 100
34 FILE *command_output = popen(
"lsusb | grep '046d:\\|256f:'",
"r");
38 ushort vendor_id = 0, product_id = 0;
39 if (sscanf(line,
"Bus %*d Device %*d: ID %hx:%hx", &vendor_id, &product_id) == 2) {
45 pclose(command_output);
70#define USE_FINISH_GLITCH_WORKAROUND
73#ifdef USE_FINISH_GLITCH_WORKAROUND
86# define MOTION_TEST_IDLE_MS 100
91 bool anyProcessed =
false;
96#ifdef USE_FINISH_GLITCH_WORKAROUND
97 bool motion_test =
false;
100 while (spnav_poll_event(&
e)) {
102 case SPNAV_EVENT_MOTION: {
105 const int t[3] = {int(
e.motion.x), int(
e.motion.y), int(-
e.motion.z)};
106 const int r[3] = {int(-
e.motion.rx), int(-
e.motion.ry), int(
e.motion.rz)};
110#ifdef USE_FINISH_GLITCH_WORKAROUND
116 case SPNAV_EVENT_BUTTON:
124#ifdef USE_FINISH_GLITCH_WORKAROUND
133 const int v[3] = {0, 0, 0};
148#undef USE_FINISH_GLITCH_WORKAROUND
#define CLOG_DEBUG(clg_ref,...)
#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
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)