Commit 2cd28914 authored by Ryan Pavlik's avatar Ryan Pavlik Committed by Jakob Bornecrantz

d/hydra: Initially-functional multi-device Razer Hydra driver.

Not pretty - no filtering on tracking, coordinate system
probably a little bit wrong still, no hemisphere tracking,
but enough to show movement and resizing in hello_xr.
parent 9a4fee38
......@@ -115,6 +115,9 @@ endif()
if(TRUE)
# Uses the Monado internal hid wrapper.
set(BUILD_DRIVER_PSMV TRUE)
add_definitions(-DXRT_BUILD_HYDRA)
set(BUILD_DRIVER_HYDRA TRUE)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter")
......
......@@ -25,6 +25,17 @@ if(BUILD_DRIVER_HDK)
endif()
if(BUILD_DRIVER_HYDRA)
set(HYDRA_SOURCE_FILES
hydra/hydra_driver.c
hydra/hydra_interface.h
)
# Use OBJECT to not create a archive, since it just gets in the way.
add_library(drv_hydra OBJECT ${HYDRA_SOURCE_FILES})
set_property(TARGET drv_hydra PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
if(BUILD_DRIVER_OHMD)
set(OHMD_SOURCE_FILES
ohmd/oh_device.c
......
This diff is collapsed.
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Interface to @ref drv_hydra
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
* @ingroup drv_hydra
*/
#pragma once
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @defgroup drv_hydra Razer Hydra Driver
* @ingroup drv
*
* @brief Driver for the Razer Hydra motion controllers.
*/
#define HYDRA_VID 0x1532
#define HYDRA_PID 0x0300
/*!
* Probing function for Razer Hydra devices.
*
* @ingroup drv_hydra
*/
int
hydra_found(struct xrt_prober *xp,
struct xrt_prober_device **devices,
size_t index,
struct xrt_device **out_xdevs);
/*!
* @dir drivers/hydra
*
* @brief @ref drv_hydra files.
*/
#ifdef __cplusplus
}
#endif
......@@ -270,6 +270,17 @@ enum xrt_input_name
XRT_INPUT_PSMV_BODY_CENTER_POSE = XRT_INPUT_NAME(0x0029, POSE),
XRT_INPUT_PSMV_BALL_CENTER_POSE = XRT_INPUT_NAME(0x002A, POSE),
XRT_INPUT_PSMV_BALL_TIP_POSE = XRT_INPUT_NAME(0x002B, POSE),
XRT_INPUT_HYDRA_1_CLICK = XRT_INPUT_NAME(0x0030, BOOLEAN),
XRT_INPUT_HYDRA_2_CLICK = XRT_INPUT_NAME(0x0031, BOOLEAN),
XRT_INPUT_HYDRA_3_CLICK = XRT_INPUT_NAME(0x0032, BOOLEAN),
XRT_INPUT_HYDRA_4_CLICK = XRT_INPUT_NAME(0x0033, BOOLEAN),
XRT_INPUT_HYDRA_MIDDLE_CLICK = XRT_INPUT_NAME(0x0034, BOOLEAN),
XRT_INPUT_HYDRA_BUMPER_CLICK = XRT_INPUT_NAME(0x0035, BOOLEAN),
XRT_INPUT_HYDRA_JOYSTICK_CLICK = XRT_INPUT_NAME(0x0036, BOOLEAN),
XRT_INPUT_HYDRA_JOYSTICK_VALUE = XRT_INPUT_NAME(0x0037, VEC2_MINUS_ONE_TO_ONE),
XRT_INPUT_HYDRA_TRIGGER_VALUE = XRT_INPUT_NAME(0x0038, VEC1_ZERO_TO_ONE),
XRT_INPUT_HYDRA_POSE = XRT_INPUT_NAME(0x0039, POSE),
// clang-format on
};
......
......@@ -24,6 +24,10 @@ if(BUILD_DRIVER_HDK)
list(APPEND DRIVER_LIBRARIES ${HIDAPI_LIBRARIES})
endif()
if(BUILD_DRIVER_HYDRA)
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_hydra>)
endif()
if(BUILD_DRIVER_OHMD)
set(XRT_BUILD_OHMD TRUE)
list(APPEND DRIVER_OBJECTS $<TARGET_OBJECTS:drv_ohmd>)
......
......@@ -26,6 +26,10 @@
#include "psvr/psvr_interface.h"
#endif
#ifdef XRT_BUILD_HYDRA
#include "hydra/hydra_interface.h"
#endif
/*!
* Each entry should be a vendor ID (VID), product ID (PID), a "found" function,
......@@ -48,6 +52,11 @@ struct xrt_prober_entry target_entry_list[] = {
#ifdef XRT_BUILD_PSMV
{PSMV_VID, PSMV_PID, psmv_found, "PS Move"},
#endif
#ifdef XRT_BUILD_HYDRA
{HYDRA_VID, HYDRA_PID, hydra_found, "Razer Hydra"},
#endif
{0x0000, 0x0000, NULL, NULL}, // Terminate
};
......
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