···3131#include "euroc/euroc_interface.h"
3232#endif
33333434+#ifdef XRT_BUILD_DRIVER_RS
3535+#include "realsense/rs_interface.h"
3636+#endif
3737+3438#ifdef XRT_BUILD_DRIVER_REMOTE
3539#include "remote/r_interface.h"
3640#endif
···5357DEBUG_GET_ONCE_BOOL_OPTION(qwerty_combine, "QWERTY_COMBINE", false)
5458DEBUG_GET_ONCE_OPTION(vf_path, "VF_PATH", NULL)
5559DEBUG_GET_ONCE_OPTION(euroc_path, "EUROC_PATH", NULL)
6060+DEBUG_GET_ONCE_NUM_OPTION(rs_source_index, "RS_SOURCE_INDEX", -1)
566157625863/*
···9961001 }
9971002#endif
998100310041004+#if defined(XRT_BUILD_DRIVER_RS)
10051005+ int rs_source_index = debug_get_num_option_rs_source_index();
10061006+ if (rs_source_index != -1) {
10071007+ *out_xfs = rs_source_create(xfctx, rs_source_index);
10081008+ return 0;
10091009+ }
10101010+#endif
10111011+9991012#if defined(XRT_HAVE_V4L2)
10001013 if (pdev->num_v4ls == 0) {
10011014 return -1;
···10221035 // Video sources from drivers (at most one will be listed)
10231036 const char *vf_path = debug_get_option_vf_path();
10241037 const char *euroc_path = debug_get_option_euroc_path();
10381038+ int rs_source_index = debug_get_num_option_rs_source_index();
1025103910261040 if (vf_path != NULL) {
10271041 cb(xp, NULL, "Video File", "Collabora", vf_path, ptr);
10281042 } else if (euroc_path != NULL) {
10291043 cb(xp, NULL, "Euroc Dataset", "Collabora", euroc_path, ptr);
10441044+ } else if (rs_source_index != -1) {
10451045+ cb(xp, NULL, "RealSense Source", "Collabora", "", ptr);
10301046 }
1031104710321048 // Video sources from video devices
+35
src/xrt/state_trackers/prober/p_tracking.c
···3131DEBUG_GET_ONCE_OPTION(euroc_path, "EUROC_PATH", NULL)
3232#endif
33333434+#ifdef XRT_BUILD_DRIVER_RS
3535+#include "util/u_debug.h"
3636+DEBUG_GET_ONCE_NUM_OPTION(rs_source_index, "RS_SOURCE_INDEX", -1)
3737+#endif
3838+3439/*
3540 *
3641 * Structs and defines.
···241246static bool
242247p_factory_ensure_slam_frameserver(struct p_factory *fact)
243248{
249249+ //! @todo The check for (XRT_HAVE_SLAM && XRT_BUILD_DRIVER_* &&
250250+ //! debug_flag_is_correct) is getting duplicated in: p_open_video_device,
251251+ //! p_list_video_devices, and p_factory_ensure_slam_frameserver (here) with
252252+ //! small differences. Incorrectly modifying one will mess the others.
253253+244254 // Factory frameserver is already in use
245255 if (fact->xfs != NULL) {
246256 return false;
···263273 }
264274#else
265275 U_LOG_W("SLAM tracking support is disabled, the Euroc driver will not be tracked");
276276+#endif
277277+278278+ xrt_fs_slam_stream_start(fact->xfs, sinks);
279279+280280+ return true;
281281+ }
282282+#endif
283283+284284+ // SLAM tracker with RealSense frameserver
285285+286286+#ifdef XRT_BUILD_DRIVER_RS
287287+ if (debug_get_num_option_rs_source_index() != -1) {
288288+ struct xrt_slam_sinks empty_sinks = {0};
289289+ struct xrt_slam_sinks *sinks = &empty_sinks;
290290+291291+ xrt_prober_open_video_device(&fact->p->base, NULL, &fact->xfctx, &fact->xfs);
292292+ assert(fact->xfs->source_id == 0x2EA15E115E && "xfs is not RealSense, unsynced open_video_device?");
293293+294294+#ifdef XRT_HAVE_SLAM
295295+ int ret = t_slam_create(&fact->xfctx, &fact->xts, &sinks);
296296+ if (ret != 0) {
297297+ U_LOG_W("Unable to initialize SLAM tracking, the RealSense driver will not be tracked");
298298+ }
299299+#else
300300+ U_LOG_W("SLAM tracking support is disabled, the RealSense driver will not be tracked by host SLAM");
266301#endif
267302268303 xrt_fs_slam_stream_start(fact->xfs, sinks);