Monado OpenXR Runtime
Loading...
Searching...
No Matches
rift_interface.h
Go to the documentation of this file.
1// Copyright 2025, Beyley Cardellio
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Interface to Oculus Rift driver code.
6 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
7 * @ingroup drv_rift
8 */
9
10#pragma once
11
12#include "xrt/xrt_device.h"
13#include "xrt/xrt_defines.h"
14#include "xrt/xrt_prober.h"
15
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21
22struct rift_hmd;
23
24enum rift_variant
25{
26 RIFT_VARIANT_DK1,
27 RIFT_VARIANT_DK2,
28 RIFT_VARIANT_CV1,
29};
30
31#define OCULUS_VR_VID 0x2833
32
33#define OCULUS_DK2_PID 0x0021
34#define OCULUS_DK2_SENSOR_PID 0x0201
35#define OCULUS_CV1_PID 0x0031
36#define OCULUS_CV1_SENSOR_PID 0x0211
37
38#define RIFT_DK2_PRODUCT_STRING "Rift DK2"
39#define RIFT_CV1_PRODUCT_STRING "Rift CV1"
40
41/*!
42 * Checks whether the given device is an Oculus device, by checking the manufacturer string.
43 *
44 * @ingroup drv_rift
45 * @param xp The prober to use for getting string descriptors.
46 * @param dev The device to check.
47 * @return true if the device is an Oculus device, false otherwise.
48 */
49bool
50rift_is_oculus(struct xrt_prober *xp, struct xrt_prober_device *dev);
51
52/*!
53 * Probing function for Oculus Rift devices.
54 *
55 * @ingroup drv_rift
56 * @see xrt_prober_found_func_t
57 */
58int
59rift_found(struct xrt_prober *xp,
60 struct xrt_prober_device **devices,
61 size_t device_count,
62 size_t index,
63 cJSON *attached_data,
64 struct xrt_device **out_xdev);
65
66int
67rift_devices_create(struct os_hid_device *hmd_dev,
68 struct os_hid_device *radio_dev,
69 enum rift_variant variant,
70 const char *serial_number,
71 struct rift_hmd **out_hmd,
72 struct xrt_device **out_xdevs);
73
74bool
75rift_get_radio_id(struct rift_hmd *hmd, uint8_t out_radio_id[5]);
76
77/*!
78 * @dir drivers/rift
79 *
80 * @brief @ref drv_rift files.
81 */
82
83#ifdef __cplusplus
84}
85#endif
int rift_found(struct xrt_prober *xp, struct xrt_prober_device **devices, size_t device_count, size_t index, cJSON *attached_data, struct xrt_device **out_xdev)
Probing function for Oculus Rift devices.
Definition rift_prober.c:48
bool rift_is_oculus(struct xrt_prober *xp, struct xrt_prober_device *dev)
Checks whether the given device is an Oculus device, by checking the manufacturer string.
Definition rift_prober.c:29
Representing a single hid interface on a device.
Definition os_hid.h:29
A rift HMD device.
Definition rift_internal.h:825
A single HMD or input device.
Definition xrt_device.h:310
struct xrt_hmd_parts * hmd
Null if this device does not interface with the users head.
Definition xrt_device.h:322
A probed device, may or may not be opened.
Definition xrt_prober.h:86
The main prober that probes and manages found but not opened HMD devices that are connected to the sy...
Definition xrt_prober.h:133
Common defines and enums for XRT.
Header defining an xrt display or controller device.
Common interface to probe for devices.