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: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2188>
This commit is contained in:
Jan Schmidt 2023-08-20 02:14:06 +10:00 committed by Marge Bot
parent 34377371ba
commit ecaab0f63e

View file

@ -2138,7 +2138,9 @@ wmr_hmd_create(enum wmr_headset_type hmd_type,
if (wmr_hmd_request_controller_status(wh)) { if (wmr_hmd_request_controller_status(wh)) {
/* @todo: Add a timed version of os_cond_wait and a timeout? */ /* @todo: Add a timed version of os_cond_wait and a timeout? */
/* This will be signalled from the reader thread */ /* 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; have_controller_status = true;
} }
os_mutex_unlock(&wh->controller_status_lock); os_mutex_unlock(&wh->controller_status_lock);