The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/system_helpers: Use new xrt_prober_create_system function

+1 -67
+1 -67
src/xrt/auxiliary/util/u_system_helpers.c
··· 37 37 free(usysd); 38 38 } 39 39 40 - static struct xrt_device * 41 - get_ht_device(struct u_system_devices *usysd, enum xrt_input_name name) 42 - { 43 - for (uint32_t i = 0; i < usysd->base.xdev_count; i++) { 44 - struct xrt_device *xdev = usysd->base.xdevs[i]; 45 - 46 - if (xdev == NULL || !xdev->hand_tracking_supported) { 47 - continue; 48 - } 49 - 50 - for (uint32_t j = 0; j < xdev->input_count; j++) { 51 - struct xrt_input *input = &xdev->inputs[j]; 52 - 53 - if (input->name == name) { 54 - return xdev; 55 - } 56 - } 57 - } 58 - 59 - return NULL; 60 - } 61 - 62 40 63 41 /* 64 42 * ··· 78 56 xrt_result_t 79 57 u_system_devices_create_from_prober(struct xrt_instance *xinst, struct xrt_system_devices **out_xsysd) 80 58 { 81 - struct u_system_devices *usysd = u_system_devices_allocate(); 82 59 int ret = 0; 83 60 84 61 assert(out_xsysd != NULL); ··· 100 77 return XRT_ERROR_ALLOCATION; 101 78 } 102 79 103 - ret = xrt_prober_select(xp, usysd->base.xdevs, ARRAY_SIZE(usysd->base.xdevs)); 104 - if (ret < 0) { 105 - u_system_devices_destroy(&usysd); 106 - } 107 - 108 - // Count the xdevs. 109 - for (uint32_t i = 0; i < ARRAY_SIZE(usysd->base.xdevs); i++) { 110 - if (usysd->base.xdevs[i] == NULL) { 111 - break; 112 - } 113 - 114 - usysd->base.xdev_count++; 115 - } 116 - 117 - 118 - /* 119 - * Setup the roles. 120 - */ 121 - 122 - int head, left, right; 123 - u_device_assign_xdev_roles(usysd->base.xdevs, usysd->base.xdev_count, &head, &left, &right); 124 - 125 - if (head >= 0) { 126 - usysd->base.roles.head = usysd->base.xdevs[head]; 127 - } 128 - if (left >= 0) { 129 - usysd->base.roles.left = usysd->base.xdevs[left]; 130 - } 131 - if (right >= 0) { 132 - usysd->base.roles.right = usysd->base.xdevs[right]; 133 - } 134 - 135 - // Find hand tracking devices. 136 - usysd->base.roles.hand_tracking.left = get_ht_device(usysd, XRT_INPUT_GENERIC_HAND_TRACKING_LEFT); 137 - usysd->base.roles.hand_tracking.right = get_ht_device(usysd, XRT_INPUT_GENERIC_HAND_TRACKING_RIGHT); 138 - 139 - 140 - /* 141 - * Done. 142 - */ 143 - 144 - *out_xsysd = &usysd->base; 145 - 146 - return XRT_SUCCESS; 80 + return xrt_prober_create_system(xp, out_xsysd); 147 81 }