Commit 97c3de6f authored by Christoph Haag's avatar Christoph Haag

d/survive: Add survive driver

parent 76987108
Pipeline #143425 failed with stages
in 42 seconds
......@@ -90,8 +90,8 @@ cmake_dependent_option(BUILD_WITH_FFMPEG "Enable ffmpeg testing video driver" ON
cmake_dependent_option(BUILD_WITH_PSVR "Enable PSVR HMD driver" ON "HIDAPI_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_RS "Enable RealSense device driver" ON "realsense2_FOUND" OFF)
option(BUILD_WITH_DUMMY "Enable dummy driver" ON)
cmake_dependent_option(BUILD_WITH_VIVE "Enable Vive driver" ON "ZLIB_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_OPENHMD "Enable OpenHMD driver" ON "OPENHMD_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_VIVE "Enable Vive driver" OFF "ZLIB_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_OPENHMD "Enable OpenHMD driver" OFF "OPENHMD_FOUND" OFF)
cmake_dependent_option(BUILD_WITH_SDL2 "Enable SDL2 based test application" ON "SDL2_FOUND AND BUILD_WITH_OPENGL" OFF)
cmake_dependent_option(BUILD_WITH_DAYDREAM "Enable Bluetooth LE via DBUS" ON "BUILD_WITH_DBUS" OFF)
cmake_dependent_option(BUILD_WITH_ARDUINO "Enable Arduino input device with BLE via DBUS" ON "BUILD_WITH_DBUS" OFF)
......@@ -103,6 +103,7 @@ option(BUILD_WITH_HDK "Enable HDK driver" ON)
option(BUILD_WITH_PSMV "Enable Playstation Move driver" ON)
option(BUILD_WITH_HYDRA "Enable Hydra driver" ON)
option(BUILD_WITH_NS "Enable North Star driver" ON)
option(BUILD_WITH_LIBSURVIVE "Enable libsurvive driver" ON)
# You can set this from a superproject to add a driver
list(APPEND AVAILABLE_DRIVERS ARDUINO DUMMY HDK HYDRA NS OHMD PSMV PSVR RS V4L2 VIVE DAYDREAM)
......@@ -178,6 +179,13 @@ if(BUILD_WITH_NS)
set(BUILD_DRIVER_NS TRUE)
endif()
if (BUILD_WITH_LIBSURVIVE)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SURVIVE REQUIRED IMPORTED_TARGET survive)
add_definitions(-DXRT_BUILD_DRIVER_SURVIVE)
set(BUILD_DRIVER_SURVIVE TRUE)
endif()
if(BUILD_WITH_PSVR)
if (NOT ${HIDAPI_FOUND})
message(FATAL_ERROR "PSVR driver requires hidapi")
......
# Monado - XR Runtime (XRT)
# Monado - XR Runtime (XRT) - experimental libsurvive branch
> * Promotional homepage: <https://monado.dev>
> * Maintained at <https://gitlab.freedesktop.org/monado/monado>
......@@ -14,6 +14,26 @@ The project currently is being developed for GNU/Linux
and aims to support other operating systems in the near future.
"Monado" has no specific meaning and is just a name.
# About the libsurvive Branch
This branch requires libsurvive to be installed as a library with a pkgconfig file
(https://github.com/cntools/libsurvive/pull/187).
It can be built with cmake and with meson.
A device prober using the libsurvive simple api is implemented in src/xrt/drivers/survive.
When starting any libsrvive or OpenXR application, libsurvive will run calibration and save
configuration and calibration data in the current working directory.
Make sure the HMD can see both basestations and is not moved during calibration.
To remove libsurvive's calibration data (e.g. to force recalibration) delete the following
files/directories:
rm -r *config.json calinfo
Though working and usable, support for the libsurvive driver is **experimental**.
## Monado source tree
* `src/xrt/include` - headers that define the internal interfaces of Monado.
......
......@@ -65,6 +65,7 @@ udev = dependency('libudev', required: false)
libuvc = dependency('libuvc', required: false)
vulkan = dependency('vulkan', required: true)
zlib = dependency('zlib', required: false)
survive = dependency('survive', required: true) # TODO: false when branch is merged
opencv = dependency('opencv4', required: false)
if not opencv.found()
......@@ -153,7 +154,7 @@ if 'auto' in drivers or 'ns' in drivers
endif
endif
if openhmd.found() and ('auto' in drivers or 'ohmd' in drivers)
if openhmd.found() and ('ohmd' in drivers)
if 'ohmd' not in drivers
drivers += ['ohmd']
endif
......@@ -165,7 +166,7 @@ if hidapi.found() and ('auto' in drivers or 'psvr' in drivers or 'hdk' in driver
endif
endif
if zlib.found() and ('auto' in drivers or 'vive' in drivers)
if zlib.found() and ('vive' in drivers)
if 'vive' not in drivers
drivers += ['vive']
endif
......@@ -183,6 +184,12 @@ if v4l2.found() and ('auto' in drivers or 'v4l2' in drivers)
endif
endif
if survive.found() and ('auto' in drivers or 'survive' in drivers)
if 'survive' not in drivers
drivers += ['survive']
endif
endif
if drivers.length() == 0 or drivers == ['auto']
error('You must enable at least one driver.')
endif
......
......@@ -3,7 +3,7 @@
option('drivers',
type: 'array',
choices: ['auto', 'dummy', 'hdk', 'hydra', 'ns', 'ohmd', 'psmv', 'psvr', 'rs', 'v4l2', 'vive'],
choices: ['auto', 'dummy', 'hdk', 'hydra', 'ns', 'ohmd', 'psmv', 'psvr', 'rs', 'v4l2', 'vive', 'survive'],
value: ['auto'],
description: 'Set of drivers to build')
......
......@@ -2,4 +2,5 @@
# SPDX-License-Identifier: BSL-1.0
add_subdirectory(external)
add_subdirectory(xrt)
......@@ -162,6 +162,20 @@ if(BUILD_DRIVER_V4L2)
list(APPEND ENABLED_DRIVERS v4l2)
endif()
if (BUILD_WITH_LIBSURVIVE)
set(SURVIVE_SOURCE_FILES
survive/survive_driver.c
survive/survive_interface.h
survive/survive_wrap.c
survive/survive_wrap.h
)
add_library(drv_survive STATIC ${SURVIVE_SOURCE_FILES})
target_link_libraries(drv_survive PRIVATE xrt-interfaces aux_os aux_util aux_math PkgConfig::SURVIVE)
set_property(TARGET drv_survive PROPERTY POSITION_INDEPENDENT_CODE ON)
list(APPEND ENABLED_HEADSET_DRIVERS survive)
endif()
if(ENABLED_HEADSET_DRIVERS)
set(ENABLED_DRIVERS ${ENABLED_HEADSET_DRIVERS} ${ENABLED_DRIVERS})
list(SORT ENABLED_DRIVERS)
......
......@@ -136,3 +136,19 @@ lib_drv_vive = static_library(
dependencies: [aux, zlib],
build_by_default: 'vive' in drivers,
)
lib_drv_survive = static_library(
'drv_survive',
files(
'survive/survive_driver.c',
'survive/survive_interface.h',
'survive/survive_wrap.c',
'survive/survive_wrap.h'
),
include_directories: [
xrt_include,
cjson_include,
],
dependencies: [aux, zlib, survive],
build_by_default: 'survive' in drivers,
)
This diff is collapsed.
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: Apache-2.0
/*!
* @file
* @brief Interface to OpenHMD driver code.
* @author Jakob Bornecrantz <jakob@collabora.com>
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#define HTC_VID 0x0bb4
#define VALVE_VID 0x28de
#define VIVE_PID 0x2c87
#define VIVE_LIGHTHOUSE_FPGA_RX 0x2000
#define VIVE_PRO_MAINBOARD_PID 0x0309
#define VIVE_PRO_LHR_PID 0x2300
int
survive_found(struct xrt_prober *xp,
struct xrt_prober_device **devices,
size_t num_devices,
size_t index,
cJSON *attached_data,
struct xrt_device **out_xdevs);
#ifdef __cplusplus
}
#endif
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief low level libsurvive wrapper
* @author Christoph Haag <christoph.haag@collabora.com>
* @ingroup drv_survive
*/
#define SURVIVE_ENABLE_FULL_API 1
#include "survive_api.h"
#include "survive_wrap.h"
// TODO: expose config values we need through actual survive API
#include "survive.h"
bool
survive_config_ready(const SurviveSimpleObject *sso)
{
SurviveObject *so = survive_simple_get_survive_object(sso);
return so->conf != 0;
}
char *
survive_get_json_config(const SurviveSimpleObject *sso)
{
SurviveObject *so = survive_simple_get_survive_object(sso);
return so->conf;
}
// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief low level libsurvive wrapper
* @author Christoph Haag <christoph.haag@collabora.com>
* @ingroup drv_survive
*/
#pragma once
#include "survive_api.h"
bool
survive_config_ready(const SurviveSimpleObject *sso);
char *
survive_get_json_config(const SurviveSimpleObject *sso);
......@@ -67,6 +67,9 @@ if(BUILD_DRIVER_VIVE)
target_link_libraries(target_lists PRIVATE drv_vive)
endif()
if(BUILD_DRIVER_SURVIVE)
target_link_libraries(target_lists PRIVATE drv_survive)
endif()
####
# Instance
......
......@@ -22,7 +22,7 @@
#include "hdk/hdk_interface.h"
#endif
#ifdef XRT_BUILD_DRIVER_OHMD
#ifdef XRT_BUILD_OHMD
#include "ohmd/oh_interface.h"
#endif
......@@ -42,6 +42,10 @@
#include "hydra/hydra_interface.h"
#endif
#ifdef XRT_BUILD_DRIVER_SURVIVE
#include "survive/survive_interface.h"
#endif
#ifdef XRT_BUILD_DRIVER_VIVE
#include "vive/vive_prober.h"
#include "vive/vive_controller_interface.h"
......@@ -82,6 +86,12 @@ struct xrt_prober_entry target_entry_list[] = {
{HDK_VID, HDK_PID, hdk_found, "OSVR HDK"},
#endif // XRT_BUILD_DRIVER_HDK
#ifdef XRT_BUILD_DRIVER_SURVIVE
{HTC_VID, VIVE_PID, survive_found, "HTC Vive"},
{HTC_VID, VIVE_PRO_MAINBOARD_PID, survive_found, "HTC Vive Pro"},
{VALVE_VID, VIVE_PRO_LHR_PID, survive_found, "Valve Index"},
#endif
#ifdef XRT_BUILD_DRIVER_VIVE
{HTC_VID, VIVE_PID, vive_found, "HTC Vive"},
{HTC_VID, VIVE_PRO_MAINBOARD_PID, vive_found, "HTC Vive Pro"},
......
......@@ -54,6 +54,10 @@ if 'vive' in drivers
driver_libs += [lib_drv_vive]
endif
if 'survive' in drivers
driver_libs += [lib_drv_survive]
endif
subdir('common')
subdir('openxr')
subdir('cli')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment