u/device: Assign left/right hand trackers if no controllers are available

Previously the left/right role assignment considered only device types
* XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER
* XRT_DEVICE_TYPE_RIGHT_HAND_CONTROLLER
* XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER

This adds XRT_DEVICE_TYPE_HAND_TRACKER for consideration, but only if none
of the above are present.
This commit is contained in:
Christoph Haag 2020-12-27 00:10:12 +01:00 committed by Jakob Bornecrantz
parent 057f65630f
commit 7831e38c02

View file

@ -350,6 +350,22 @@ u_device_assign_xdev_roles(struct xrt_device **xdevs,
default: break;
}
}
// fill unassigned left/right with hand trackers if available
for (size_t i = 0; i < num_xdevs; i++) {
if (xdevs[i] == NULL) {
continue;
}
if (xdevs[i]->device_type == XRT_DEVICE_TYPE_HAND_TRACKER) {
if (*left == XRT_DEVICE_ROLE_UNASSIGNED) {
*left = i;
}
if (*right == XRT_DEVICE_ROLE_UNASSIGNED) {
*right = i;
}
break;
}
}
}
static void