diff --git a/src/xrt/drivers/qwerty/qwerty_interface.h b/src/xrt/drivers/qwerty/qwerty_interface.h index 1f452363b..db5b520d9 100644 --- a/src/xrt/drivers/qwerty/qwerty_interface.h +++ b/src/xrt/drivers/qwerty/qwerty_interface.h @@ -55,6 +55,17 @@ qwerty_create_auto_prober(void); void qwerty_process_event(struct xrt_device **xdevs, size_t xdev_count, SDL_Event event); +/*! + * Create all qwerty devices. + * + * @ingroup drv_qwerty + */ +xrt_result_t +qwerty_create_devices(enum u_logging_level log_level, + struct xrt_device **out_hmd, + struct xrt_device **out_left, + struct xrt_device **out_right); + #ifdef __cplusplus } diff --git a/src/xrt/drivers/qwerty/qwerty_prober.c b/src/xrt/drivers/qwerty/qwerty_prober.c index d3df0b130..fa9cf5a74 100644 --- a/src/xrt/drivers/qwerty/qwerty_prober.c +++ b/src/xrt/drivers/qwerty/qwerty_prober.c @@ -7,11 +7,15 @@ * @ingroup drv_qwerty */ -#include "qwerty_device.h" +#include "xrt/xrt_prober.h" + #include "util/u_misc.h" #include "util/u_debug.h" #include "util/u_logging.h" -#include "xrt/xrt_prober.h" + +#include "qwerty_device.h" +#include "qwerty_interface.h" + // Using INFO as default to inform events real devices could report physically DEBUG_GET_ONCE_LOG_OPTION(qwerty_log, "QWERTY_LOG", U_LOGGING_INFO) @@ -72,6 +76,13 @@ qwerty_prober_autoprobe(struct xrt_auto_prober *xap, return num_qwerty_devices; } + +/* + * + * 'Exported' functions. + * + */ + struct xrt_auto_prober * qwerty_create_auto_prober(void) { @@ -82,3 +93,22 @@ qwerty_create_auto_prober(void) return &qp->base; } + +xrt_result_t +qwerty_create_devices(enum u_logging_level log_level, + struct xrt_device **out_hmd, + struct xrt_device **out_left, + struct xrt_device **out_right) +{ + struct qwerty_hmd *qhmd = qwerty_hmd_create(); + struct qwerty_controller *qleft = qwerty_controller_create(true, qhmd); + struct qwerty_controller *qright = qwerty_controller_create(false, qhmd); + + qwerty_system_create(qhmd, qleft, qright, log_level); + + *out_hmd = &qhmd->base.base; + *out_left = &qleft->base.base; + *out_right = &qright->base.base; + + return XRT_SUCCESS; +}