mirror of
https://github.com/lbgos/rift-s-linux.git
synced 2026-10-26 06:00:20 +01:00
u/system_helpers: Use new xrt_prober_create_system function
This commit is contained in:
1 parent
3357cd4400
commit
9285bee210
1 file changed
+1
-67
@@ -37,28 +37,6 @@ destroy(struct xrt_system_devices *xsysd)
|
||||
free(usysd);
|
||||
}
|
||||
|
||||
static struct xrt_device *
|
||||
get_ht_device(struct u_system_devices *usysd, enum xrt_input_name name)
|
||||
{
|
||||
for (uint32_t i = 0; i < usysd->base.xdev_count; i++) {
|
||||
struct xrt_device *xdev = usysd->base.xdevs[i];
|
||||
|
||||
if (xdev == NULL || !xdev->hand_tracking_supported) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint32_t j = 0; j < xdev->input_count; j++) {
|
||||
struct xrt_input *input = &xdev->inputs[j];
|
||||
|
||||
if (input->name == name) {
|
||||
return xdev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -78,7 +56,6 @@ u_system_devices_allocate(void)
|
||||
xrt_result_t
|
||||
u_system_devices_create_from_prober(struct xrt_instance *xinst, struct xrt_system_devices **out_xsysd)
|
||||
{
|
||||
struct u_system_devices *usysd = u_system_devices_allocate();
|
||||
int ret = 0;
|
||||
|
||||
assert(out_xsysd != NULL);
|
||||
@@ -100,48 +77,5 @@ u_system_devices_create_from_prober(struct xrt_instance *xinst, struct xrt_syste
|
||||
return XRT_ERROR_ALLOCATION;
|
||||
}
|
||||
|
||||
ret = xrt_prober_select(xp, usysd->base.xdevs, ARRAY_SIZE(usysd->base.xdevs));
|
||||
if (ret < 0) {
|
||||
u_system_devices_destroy(&usysd);
|
||||
}
|
||||
|
||||
// Count the xdevs.
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(usysd->base.xdevs); i++) {
|
||||
if (usysd->base.xdevs[i] == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
usysd->base.xdev_count++;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Setup the roles.
|
||||
*/
|
||||
|
||||
int head, left, right;
|
||||
u_device_assign_xdev_roles(usysd->base.xdevs, usysd->base.xdev_count, &head, &left, &right);
|
||||
|
||||
if (head >= 0) {
|
||||
usysd->base.roles.head = usysd->base.xdevs[head];
|
||||
}
|
||||
if (left >= 0) {
|
||||
usysd->base.roles.left = usysd->base.xdevs[left];
|
||||
}
|
||||
if (right >= 0) {
|
||||
usysd->base.roles.right = usysd->base.xdevs[right];
|
||||
}
|
||||
|
||||
// Find hand tracking devices.
|
||||
usysd->base.roles.hand_tracking.left = get_ht_device(usysd, XRT_INPUT_GENERIC_HAND_TRACKING_LEFT);
|
||||
usysd->base.roles.hand_tracking.right = get_ht_device(usysd, XRT_INPUT_GENERIC_HAND_TRACKING_RIGHT);
|
||||
|
||||
|
||||
/*
|
||||
* Done.
|
||||
*/
|
||||
|
||||
*out_xsysd = &usysd->base;
|
||||
|
||||
return XRT_SUCCESS;
|
||||
return xrt_prober_create_system(xp, out_xsysd);
|
||||
}
|
||||
Reference in new issue
Block a user