Monado OpenXR Runtime
Loading...
Searching...
No Matches
rift_sensor_internal.h
Go to the documentation of this file.
1// Copyright 2025-2026, Beyley Cardellio
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Internal structures for Oculus Rift sensor probing/initialization
6 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
7 * @ingroup drv_rift_sensor
8 */
9
10#include "xrt/xrt_frame.h"
11#include "xrt/xrt_byte_order.h"
12
13#include "os/os_threading.h"
14
16
17#include <libusb.h>
18
19
21{
22 struct xrt_frame_node node;
23
24 enum u_logging_level log_level;
25
26 struct libusb_context *usb_ctx;
27
28 struct rift_sensor *sensors;
29 uint32_t sensor_count;
30
31 struct os_thread_helper usb_thread;
32};
33
35{
36 enum rift_variant variant;
37 struct xrt_fs *frame_server;
38 struct t_camera_calibration calibration;
39 struct libusb_device_handle *hid_dev;
40 bool usb2;
41
42 time_duration_ns frame_interval;
43};
44
45#define SIZE_ASSERT(type, size) \
46 static_assert(sizeof(type) == (size), "Size of " #type " is not " #size " bytes as was expected")
47
48#pragma pack(push, 1)
49
51{
52 uint8_t unk1[18]; // 00
53 __lef64 fx; // 18
54 uint8_t unk2[4]; // 26
55 __lef64 fy; // 30
56 uint8_t unk3[4]; // 38
57 __lef64 cx; // 42
58 uint8_t unk4[4]; // 50
59 __lef64 cy; // 54
60 uint8_t unk5[4]; // 62
61 __lef64 k1; // 66
62 uint8_t unk6[4]; // 74
63 __lef64 k2; // 78
64 uint8_t unk7[4]; // 86
65 __lef64 p1; // 90
66 uint8_t unk8[4]; // 98
67 __lef64 p2; // 102
68 uint8_t unk9[4]; // 110
69 __lef64 k3; // 114
70 uint8_t pad[6]; // 122
71};
72SIZE_ASSERT(struct rift_sensor_dk2_calib, 128);
73
74#define CV1_CALIB_MAGIC 0xBAADF00DDEADD00D
75#define CV1_CALIB_SIZE 160
76
77enum rift_sensor_cv1_lens_type
78{
79 RIFT_SENSOR_CV1_LENS_TYPE_RADTAN = 0x0,
80 RIFT_SENSOR_CV1_LENS_TYPE_KB_LEGACY = 0x1,
81 RIFT_SENSOR_CV1_LENS_TYPE_OLD_BA_REJECTED = 0x2,
82 RIFT_SENSOR_CV1_LENS_TYPE_RADTAN_RECIPROCAL = 0x3,
83 RIFT_SENSOR_CV1_LENS_TYPE_IDENTITY = 0x4,
84 RIFT_SENSOR_CV1_LENS_TYPE_KB_SPLINE = 0x5,
85 RIFT_SENSOR_CV1_LENS_TYPE_CV1 = 0x6,
86 RIFT_SENSOR_CV1_LENS_TYPE_OPAQUE_BLOB = 0x7,
87};
88
90{
91 __le64 magic; // 0x00
92 __le64 version; // 0x08
93 uint8_t header_unk1[0x8]; // 0x10
94 __le32 crc; // 0x18
95 __le32 payload_length; // 0x1c
96 uint8_t body[CV1_CALIB_SIZE - 0x20]; // 0x20
97};
98SIZE_ASSERT(struct rift_sensor_cv1_calib, CV1_CALIB_SIZE);
99
100#pragma pack(pop)
101
102static struct rift_sensor_context *
104{
105 return container_of(node, struct rift_sensor_context, node);
106}
u_logging_level
Logging level enum.
Definition u_logging.h:45
int64_t time_duration_ns
Integer duration type in nanoseconds.
Definition u_time.h:88
#define container_of(ptr, type, field)
Get the holder from a pointer to a field.
Definition xrt_compiler.h:298
Wrapper around OS threading native functions.
Interface to Oculus Rift sensor probing/initialization.
Little endian 64-bit float wrapper struct.
Definition xrt_byte_order.h:142
All in one helper that handles locking, waiting for change and starting a thread.
Definition os_threading.h:500
Definition rift_sensor_internal.h:21
Definition rift_sensor_internal.h:90
Definition rift_sensor_internal.h:51
Definition rift_sensor_internal.h:35
Essential calibration data for a single camera, or single lens/sensor of a stereo camera.
Definition t_tracking.h:269
A interface object used for destroying a frame graph.
Definition xrt_frame.h:87
Frameserver that generates frames.
Definition xrt_frameserver.h:72
Endian-specific byte order defines.
Data frame header.