mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-19 13:18:32 +00:00
d/rs: Add prober and create xrt_device for rs
This commit is contained in:
parent
6c6c70f700
commit
13db11901c
|
@ -139,6 +139,7 @@ endif()
|
|||
if(XRT_BUILD_DRIVER_RS)
|
||||
set(RS_SOURCE_FILES
|
||||
realsense/rs_6dof.c
|
||||
realsense/rs_prober.c
|
||||
)
|
||||
|
||||
add_library(drv_rs STATIC ${RS_SOURCE_FILES})
|
||||
|
|
|
@ -114,6 +114,7 @@ lib_drv_rs = static_library(
|
|||
files(
|
||||
'realsense/rs_6dof.c',
|
||||
'realsense/rs_interface.h',
|
||||
'realsense/rs_prober.c',
|
||||
),
|
||||
include_directories: xrt_include,
|
||||
dependencies: [aux, rs],
|
||||
|
|
|
@ -398,7 +398,7 @@ rs_6dof_create(void)
|
|||
rs->base.get_tracked_pose = rs_6dof_get_tracked_pose;
|
||||
rs->base.get_view_pose = rs_6dof_get_view_pose;
|
||||
rs->base.destroy = rs_6dof_destroy;
|
||||
rs->base.name = XRT_DEVICE_GENERIC_HMD; // This is a lie.
|
||||
rs->base.name = XRT_DEVICE_REALSENSE;
|
||||
rs->relation.pose.orientation.w = 1.0f; // All other values set to zero.
|
||||
|
||||
rs->base.tracking_origin->type = XRT_TRACKING_TYPE_EXTERNAL_SLAM;
|
||||
|
|
|
@ -32,6 +32,14 @@ rs_6dof_create(void);
|
|||
void
|
||||
rs_update_offset(struct xrt_pose offset, struct xrt_device *xdev);
|
||||
|
||||
/*!
|
||||
* Create a auto prober for rs devices.
|
||||
*
|
||||
* @ingroup drv_rs
|
||||
*/
|
||||
struct xrt_auto_prober *
|
||||
rs_create_auto_prober(void);
|
||||
|
||||
/*!
|
||||
* @dir drivers/realsense
|
||||
*
|
||||
|
|
74
src/xrt/drivers/realsense/rs_prober.c
Normal file
74
src/xrt/drivers/realsense/rs_prober.c
Normal file
|
@ -0,0 +1,74 @@
|
|||
// Copyright 2021, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Realsense prober code.
|
||||
* @author Christoph Haag <christoph.haag@collabora.com>
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @ingroup drv_rs
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "xrt/xrt_prober.h"
|
||||
|
||||
#include "util/u_misc.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
#include "rs_interface.h"
|
||||
|
||||
/*!
|
||||
* @implements xrt_auto_prober
|
||||
*/
|
||||
struct rs_prober
|
||||
{
|
||||
struct xrt_auto_prober base;
|
||||
};
|
||||
|
||||
//! @private @memberof rs_prober
|
||||
static inline struct rs_prober *
|
||||
rs_prober(struct xrt_auto_prober *p)
|
||||
{
|
||||
return (struct rs_prober *)p;
|
||||
}
|
||||
|
||||
//! @public @memberof rs_prober
|
||||
static void
|
||||
rs_prober_destroy(struct xrt_auto_prober *p)
|
||||
{
|
||||
struct rs_prober *dp = rs_prober(p);
|
||||
|
||||
free(dp);
|
||||
}
|
||||
|
||||
//! @public @memberof rs_prober
|
||||
static int
|
||||
rs_prober_autoprobe(struct xrt_auto_prober *xap,
|
||||
cJSON *attached_data,
|
||||
bool no_hmds,
|
||||
struct xrt_prober *xp,
|
||||
struct xrt_device **out_xdevs)
|
||||
{
|
||||
struct rs_prober *dp = rs_prober(xap);
|
||||
(void)dp;
|
||||
|
||||
struct xrt_device *dev = rs_6dof_create();
|
||||
if (!dev) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
out_xdevs[0] = dev;
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct xrt_auto_prober *
|
||||
rs_create_auto_prober()
|
||||
{
|
||||
struct rs_prober *dp = U_TYPED_CALLOC(struct rs_prober);
|
||||
dp->base.name = "Realsense";
|
||||
dp->base.destroy = rs_prober_destroy;
|
||||
dp->base.lelo_dallas_autoprobe = rs_prober_autoprobe;
|
||||
|
||||
return &dp->base;
|
||||
}
|
|
@ -428,6 +428,8 @@ enum xrt_device_name
|
|||
XRT_DEVICE_HAND_INTERACTION,
|
||||
|
||||
XRT_DEVICE_HAND_TRACKER,
|
||||
|
||||
XRT_DEVICE_REALSENSE,
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
@ -338,6 +338,7 @@ public:
|
|||
case XRT_DEVICE_XBOX_CONTROLLER: break; // TODO
|
||||
case XRT_DEVICE_VIVE_TRACKER_GEN1: break; // TODO
|
||||
case XRT_DEVICE_VIVE_TRACKER_GEN2: break; // TODO
|
||||
case XRT_DEVICE_REALSENSE: break;
|
||||
|
||||
case XRT_DEVICE_HAND_INTERACTION: break; // there is no hardware
|
||||
case XRT_DEVICE_GO_CONTROLLER: break; // hardware has no haptics
|
||||
|
|
|
@ -66,6 +66,10 @@
|
|||
#include "illixr/illixr_interface.h"
|
||||
#endif
|
||||
|
||||
#ifdef XRT_BUILD_DRIVER_RS
|
||||
#include "realsense/rs_interface.h"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Each entry should be a vendor ID (VID), product ID (PID), a "found" function,
|
||||
* and a string literal name.
|
||||
|
@ -154,6 +158,10 @@ xrt_auto_prober_creator target_auto_list[] = {
|
|||
illixr_create_auto_prober,
|
||||
#endif
|
||||
|
||||
#ifdef XRT_BUILD_DRIVER_RS
|
||||
rs_create_auto_prober,
|
||||
#endif
|
||||
|
||||
#ifdef XRT_BUILD_DRIVER_DUMMY
|
||||
// Dummy headset driver last.
|
||||
dummy_create_auto_prober,
|
||||
|
|
Loading…
Reference in a new issue