From ecaab0f63e4988c9a4ddb090a21a15dfb2db7900 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sun, 20 Aug 2023 02:14:06 +1000 Subject: [PATCH] d/wmr: Fix controller status report waiting For Reverb G2 and Odyssey, check if controller status reports were already seen before proceeding to wait, or the driver might not get woken again. Part-of: --- src/xrt/drivers/wmr/wmr_hmd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xrt/drivers/wmr/wmr_hmd.c b/src/xrt/drivers/wmr/wmr_hmd.c index c8fc5264f..0ef8ba45c 100644 --- a/src/xrt/drivers/wmr/wmr_hmd.c +++ b/src/xrt/drivers/wmr/wmr_hmd.c @@ -2138,7 +2138,9 @@ wmr_hmd_create(enum wmr_headset_type hmd_type, if (wmr_hmd_request_controller_status(wh)) { /* @todo: Add a timed version of os_cond_wait and a timeout? */ /* This will be signalled from the reader thread */ - os_cond_wait(&wh->controller_status_cond, &wh->controller_status_lock); + while (!wh->have_left_controller_status && !wh->have_right_controller_status) { + os_cond_wait(&wh->controller_status_cond, &wh->controller_status_lock); + } have_controller_status = true; } os_mutex_unlock(&wh->controller_status_lock);