mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-04 06:06:17 +00:00
d/vive: Run watchman poll in separate thread
Watchman polling times out after 1 second when basestations are not present/off. This should not block reading the IMU.
This commit is contained in:
parent
07f2e62e76
commit
3a68f60d47
|
@ -51,6 +51,7 @@ vive_device_destroy(struct xrt_device *xdev)
|
|||
|
||||
// Destroy the thread object.
|
||||
os_thread_helper_destroy(&d->sensors_thread);
|
||||
os_thread_helper_destroy(&d->watchman_thread);
|
||||
os_thread_helper_destroy(&d->mainboard_thread);
|
||||
|
||||
m_imu_3dof_close(&d->fusion);
|
||||
|
@ -724,6 +725,26 @@ vive_sensors_read_lighthouse_msg(struct vive_device *d)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void *
|
||||
vive_watchman_run_thread(void *ptr)
|
||||
{
|
||||
struct vive_device *d = (struct vive_device *)ptr;
|
||||
|
||||
os_thread_helper_lock(&d->watchman_thread);
|
||||
while (os_thread_helper_is_running_locked(&d->watchman_thread)) {
|
||||
os_thread_helper_unlock(&d->watchman_thread);
|
||||
|
||||
if (d->watchman_dev)
|
||||
if (!vive_sensors_read_lighthouse_msg(d))
|
||||
return NULL;
|
||||
|
||||
// Just keep swimming.
|
||||
os_thread_helper_lock(&d->watchman_thread);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *
|
||||
vive_sensors_run_thread(void *ptr)
|
||||
{
|
||||
|
@ -739,10 +760,6 @@ vive_sensors_run_thread(void *ptr)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (d->watchman_dev)
|
||||
if (!vive_sensors_read_lighthouse_msg(d))
|
||||
return NULL;
|
||||
|
||||
// Just keep swimming.
|
||||
os_thread_helper_lock(&d->sensors_thread);
|
||||
}
|
||||
|
@ -964,5 +981,13 @@ vive_device_create(struct os_hid_device *mainboard_dev,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ret = os_thread_helper_start(&d->watchman_thread,
|
||||
vive_watchman_run_thread, d);
|
||||
if (ret != 0) {
|
||||
VIVE_ERROR(d, "Failed to start watchman thread!");
|
||||
vive_device_destroy((struct xrt_device *)d);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ struct vive_device
|
|||
enum VIVE_VARIANT variant;
|
||||
|
||||
struct os_thread_helper sensors_thread;
|
||||
struct os_thread_helper watchman_thread;
|
||||
struct os_thread_helper mainboard_thread;
|
||||
|
||||
struct lh_model lh;
|
||||
|
|
Loading…
Reference in a new issue