mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-02-15 10:10:07 +00:00
d/qwerty: Add helper create function
This commit is contained in:
parent
ef59d8e85d
commit
76c5d677d7
src/xrt/drivers/qwerty
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue