Commit b71e143e authored by Jakob Bornecrantz's avatar Jakob Bornecrantz

d/psmv: Add PS Move driver

parent 41ad2b87
......@@ -109,6 +109,12 @@ if(BUILD_WITH_HIDAPI)
set(BUILD_DRIVER_PSVR TRUE)
endif()
if(TRUE)
# Uses the Monado internal hid wrapper.
add_definitions(-DXRT_BUILD_PSMV)
set(BUILD_DRIVER_PSMV TRUE)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter")
......
......@@ -42,6 +42,18 @@ if(BUILD_DRIVER_OHMD)
endif()
if(BUILD_DRIVER_PSMV)
set(PSMOVE_SOURCE_FILES
psmv/psmv_driver.c
psmv/psmv_interface.h
)
# Use OBJECT to not create a archive, since it just gets in the way.
add_library(drv_psmv OBJECT ${PSMOVE_SOURCE_FILES})
set_property(TARGET drv_psmv PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
if(BUILD_DRIVER_PSVR)
set(PSVR_SOURCE_FILES
psvr/psvr_device.c
......
This diff is collapsed.
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Interface to @ref drv_psmv.
* @author Jakob Bornecrantz <jakob@collabora.com>
* @ingroup drv_psmv
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
/*!
* @defgroup drv_psmv PSVR driver
* @ingroup drv
*
* @brief Driver for the Sony PlayStation Move Controller.
*/
#define PSMV_VID 0x054c
#define PSMV_PID 0x03d5
/*!
* Probing function for the PSMove devices.
*
* @ingroup drv_psmv
*/
int
psmv_found(struct xrt_prober *xp,
struct xrt_prober_device **devices,
size_t index,
struct xrt_device **out_xdev);
/*!
* @dir drivers/psmv
*
* @brief @ref drv_psmv files.
*/
#ifdef __cplusplus
}
#endif
......@@ -239,6 +239,19 @@ enum xrt_input_name
// clang-format off
XRT_INPUT_GENERIC_HEAD_RELATION = XRT_INPUT_NAME(0x0000, RELATION),
XRT_INPUT_GENERIC_HEAD_DETECT = XRT_INPUT_NAME(0x0001, BOOLEAN),
XRT_INPUT_PSMV_PS_CLICK = XRT_INPUT_NAME(0x0020, BOOLEAN),
XRT_INPUT_PSMV_MOVE_CLICK = XRT_INPUT_NAME(0x0021, BOOLEAN),
XRT_INPUT_PSMV_START_CLICK = XRT_INPUT_NAME(0x0022, BOOLEAN),
XRT_INPUT_PSMV_SELECT_CLICK = XRT_INPUT_NAME(0x0023, BOOLEAN),
XRT_INPUT_PSMV_SQUARE_CLICK = XRT_INPUT_NAME(0x0024, BOOLEAN),
XRT_INPUT_PSMV_X_CLICK = XRT_INPUT_NAME(0x0025, BOOLEAN),
XRT_INPUT_PSMV_CIRCLE_CLICK = XRT_INPUT_NAME(0x0026, BOOLEAN),
XRT_INPUT_PSMV_TRIANGLE_CLICK = XRT_INPUT_NAME(0x0027, BOOLEAN),
XRT_INPUT_PSMV_TRIGGER_VALUE = XRT_INPUT_NAME(0x0028, VEC1_ZERO_TO_ONE),
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),
// clang-format on
};
......@@ -279,7 +292,7 @@ enum xrt_output_type
enum xrt_output_name
{
// clang-format off
XRT_OUTPUT_NAME_GENERIC_VIBRATION = XRT_OUTPUT_NAME(0x0000, VIBRATION),
XRT_OUTPUT_NAME_PSMV_RUMBLE_VIBRATION = XRT_OUTPUT_NAME(0x0020, VIBRATION),
// clang-format on
};
......
......@@ -16,12 +16,19 @@
#include "ohmd/oh_interface.h"
#endif
#ifdef XRT_BUILD_PSMV
#include "psmv/psmv_interface.h"
#endif
#ifdef XRT_BUILD_PSVR
#include "psvr/psvr_interface.h"
#endif
struct xrt_prober_entry target_entry_list[] = {
#ifdef XRT_BUILD_PSVR
{PSMV_VID, PSMV_PID, psmv_found, "PS Move"},
#endif
{0x0000, 0x0000, NULL, NULL}, // Terminate
};
......
......@@ -91,6 +91,10 @@ if(BUILD_DRIVER_OHMD)
target_link_libraries(${RUNTIME_TARGET} PRIVATE OpenHMD::OpenHMD)
endif()
if(BUILD_DRIVER_PSMV)
target_sources(${RUNTIME_TARGET} PRIVATE $<TARGET_OBJECTS:drv_psmv>)
endif()
if(BUILD_DRIVER_PSVR)
target_sources(${RUNTIME_TARGET} PRIVATE $<TARGET_OBJECTS:drv_psvr>)
target_link_libraries(${RUNTIME_TARGET} PUBLIC ${HIDAPI_LIBRARIES})
......
......@@ -46,6 +46,10 @@ if(BUILD_DRIVER_OHMD)
target_link_libraries(prober PRIVATE OpenHMD::OpenHMD)
endif()
if(BUILD_DRIVER_PSMV)
target_sources(prober PRIVATE $<TARGET_OBJECTS:drv_psmv>)
endif()
if(BUILD_DRIVER_PSVR)
target_sources(prober PRIVATE $<TARGET_OBJECTS:drv_psvr>)
target_link_libraries(prober PUBLIC ${HIDAPI_LIBRARIES})
......
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