d/ulv2: Convert Ultraleap driver create function to helper

This commit is contained in:
Moses Turner 2022-09-18 08:11:52 -05:00 committed by Jakob Bornecrantz
parent 833787c492
commit 5c18f83e8d
3 changed files with 6 additions and 22 deletions

View file

@ -379,13 +379,8 @@ ulv2_device_destroy(struct xrt_device *xdev)
u_device_free(&ulv2d->base); u_device_free(&ulv2d->base);
} }
int xrt_result_t
ulv2_found(struct xrt_prober *xp, ulv2_create_device(struct xrt_device **out_xdev)
struct xrt_prober_device **devices,
size_t device_count,
size_t index,
cJSON *attached_data,
struct xrt_device **out_xdev)
{ {
enum u_device_alloc_flags flags = U_DEVICE_ALLOC_NO_FLAGS; enum u_device_alloc_flags flags = U_DEVICE_ALLOC_NO_FLAGS;
@ -444,11 +439,11 @@ ulv2_found(struct xrt_prober *xp,
out_xdev[0] = &ulv2d->base; out_xdev[0] = &ulv2d->base;
return 1; return XRT_SUCCESS;
cleanup: cleanup:
ulv2_device_destroy(&ulv2d->base); ulv2_device_destroy(&ulv2d->base);
return 0; return XRT_ERROR_DEVICE_CREATION_FAILED;
} }
} // extern "C" } // extern "C"

View file

@ -35,14 +35,8 @@ extern "C" {
* @ingroup drv_ulv2 * @ingroup drv_ulv2
* @see xrt_prober_found_func_t * @see xrt_prober_found_func_t
*/ */
int xrt_result_t
ulv2_found(struct xrt_prober *xp, ulv2_create_device(struct xrt_device **out_xdev);
struct xrt_prober_device **devices,
size_t device_count,
size_t index,
cJSON *attached_data,
struct xrt_device **out_xdev);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -146,11 +146,6 @@ struct xrt_prober_entry target_entry_list[] = {
{HDK_VID, HDK_PID, hdk_found, "OSVR HDK", "osvr"}, {HDK_VID, HDK_PID, hdk_found, "OSVR HDK", "osvr"},
#endif // XRT_BUILD_DRIVER_HDK #endif // XRT_BUILD_DRIVER_HDK
#ifdef XRT_BUILD_DRIVER_ULV2
{ULV2_VID, ULV2_PID, ulv2_found, "Leap Motion Controller", "ulv2"},
#endif
#ifdef XRT_BUILD_DRIVER_DEPTHAI #ifdef XRT_BUILD_DRIVER_DEPTHAI
{DEPTHAI_VID, DEPTHAI_PID, depthai_3dof_device_found, "DepthAI Device as Head Tracker", "depthai"}, {DEPTHAI_VID, DEPTHAI_PID, depthai_3dof_device_found, "DepthAI Device as Head Tracker", "depthai"},
#endif #endif