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#include "util/u_time.h"
17
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23
24struct rift_hmd;
25
26enum rift_variant
27{
28 RIFT_VARIANT_DK1,
29 RIFT_VARIANT_DK2,
30 RIFT_VARIANT_CV1,
31};
32
33#define OCULUS_VR_VID 0x2833
34
35#define OCULUS_DK2_PID 0x0021
36#define OCULUS_DK2_SENSOR_PID 0x0201
37#define OCULUS_CV1_PID 0x0031
38#define OCULUS_CV1_SENSOR_PID 0x0211
39
40#define RIFT_DK2_PRODUCT_STRING "Rift DK2"
41#define RIFT_CV1_PRODUCT_STRING "Rift CV1"
42
43/*!
44 * Checks whether the given device is an Oculus device, by checking the manufacturer string.
45 *
46 * @ingroup drv_rift
47 * @param xp The prober to use for getting string descriptors.
48 * @param dev The device to check.
49 * @return true if the device is an Oculus device, false otherwise.
50 */
51bool
52rift_is_oculus(struct xrt_prober *xp, struct xrt_prober_device *dev);
53
54/*!
55 * Probing function for Oculus Rift devices.
56 *
57 * @ingroup drv_rift
58 * @see xrt_prober_found_func_t
59 */
60int
61rift_found(struct xrt_prober *xp,
62 struct xrt_prober_device **devices,
63 size_t device_count,
64 size_t index,
65 cJSON *attached_data,
66 struct xrt_device **out_xdev);
67
68int
69rift_devices_create(struct os_hid_device *hmd_dev,
70 struct os_hid_device *radio_dev,
71 enum rift_variant variant,
72 const char *serial_number,
73 struct rift_hmd **out_hmd,
74 struct xrt_device **out_xdevs);
75
76bool
77rift_get_radio_id(struct rift_hmd *hmd, uint8_t out_radio_id[5]);
78
79bool
80rift_hmd_frame_timestamp_callback(void *user_data, timepoint_ns *timestamp, uint32_t pts);
81
82/*!
83 * @dir drivers/rift
84 *
85 * @brief @ref drv_rift files.
86 */
87
88#ifdef __cplusplus
89}
90#endif
int64_t timepoint_ns
Integer timestamp type.
Definition u_time.h:77
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:88
The main prober that probes and manages found but not opened HMD devices that are connected to the sy...
Definition xrt_prober.h:135
Time-keeping: a clock that is steady, convertible to system time, and ideally high-resolution.
Common defines and enums for XRT.
Header defining an xrt display or controller device.
Common interface to probe for devices.