33#define REPORT_MAX_SIZE 69
34#define KEEPALIVE_INTERVAL_NS 10000000000
36#define KEEPALIVE_SEND_RATE_NS ((KEEPALIVE_INTERVAL_NS * 19) / 20)
37#define IMU_SAMPLE_RATE (1000)
38#define NS_PER_SAMPLE (1000 * 1000)
40#define DEG_TO_RAD(DEG) (DEG * M_PI / 180.0)
41#define MICROMETERS_TO_METERS(microns) (float)microns / 1000000.0f
44#define DEFAULT_EXTRA_EYE_ROTATION DEG_TO_RAD(30.0f)
46enum rift_feature_reports
49 FEATURE_REPORT_CONFIG = 2,
50 FEATURE_REPORT_CALIBRATE = 3,
51 FEATURE_REPORT_RANGE = 4,
52 FEATURE_REPORT_REGISTER = 5,
53 FEATURE_REPORT_DFU = 6,
54 FEATURE_REPORT_DK1_KEEP_ALIVE = 8,
55 FEATURE_REPORT_DISPLAY_INFO = 9,
56 FEATURE_REPORT_SERIAL = 10,
59 FEATURE_REPORT_TRACKING = 12,
60 FEATURE_REPORT_DISPLAY = 13,
61 FEATURE_REPORT_MAG_CALIBRATION = 14,
62 FEATURE_REPORT_POS_CALIBRATION = 15,
63 FEATURE_REPORT_CUSTOM_PATTERN = 16,
64 FEATURE_REPORT_KEEPALIVE_MUX = 17,
65 FEATURE_REPORT_MANUFACTURING = 18,
66 FEATURE_REPORT_UUID = 19,
67 FEATURE_REPORT_TEMPERATURE = 20,
68 FEATURE_REPORT_GYROOFFSET = 21,
69 FEATURE_REPORT_LENS_DISTORTION = 22,
72enum rift_config_report_flags
75 RIFT_CONFIG_REPORT_USE_RAW = 1,
77 RIFT_CONFIG_REPORT_INTERNAL_CALIBRATION = 1 << 1,
79 RIFT_CONFIG_REPORT_USE_CALIBRATION = 1 << 2,
81 RIFT_CONFIG_REPORT_AUTO_CALIBRATION = 1 << 3,
83 RIFT_CONFIG_REPORT_MOTION_KEEP_ALIVE = 1 << 4,
85 RIFT_CONFIG_REPORT_COMMAND_KEEP_ALIVE = 1 << 5,
88 RIFT_CONFIG_REPORT_USE_SENSOR_COORDINATES = 1 << 6,
91 RIFT_CONFIG_REPORT_OVERRIDE_POWER = 1 << 7,
94enum rift_distortion_type
96 RIFT_DISTORTION_TYPE_DIMS = 1,
97 RIFT_DISTORTION_TYPE_K = 2,
103 RIFT_LENS_TYPE_A = 0,
105 RIFT_LENS_TYPE_B = 1,
108#define IN_REPORT_DK2 11
110#define CATMULL_COEFFICIENTS 11
111#define CHROMATIC_ABBERATION_COEFFEICENT_COUNT 4
113enum rift_lens_distortion_version
116 RIFT_LENS_DISTORTION_NONE = 0,
118 RIFT_LENS_DISTORTION_LCSV_CATMULL_ROM_10_VERSION_1 = 1,
128#define RIFT_PACKED __attribute__((packed))
140 uint8_t config_flags;
144 uint16_t sample_rate;
150 uint8_t distortion_type;
152 uint16_t resolution_x;
154 uint16_t resolution_y;
156 uint32_t display_width;
158 uint32_t display_height;
162 uint32_t lens_separation;
163 uint32_t lens_distance[2];
172 uint16_t k[CATMULL_COEFFICIENTS];
174 uint16_t meters_per_tan_angle_at_center;
175 uint16_t chromatic_abberation[CHROMATIC_ABBERATION_COEFFEICENT_COUNT];
183 uint8_t num_distortions;
185 uint8_t distortion_idx;
191 uint16_t distortion_version;
205enum rift_display_mode
207 RIFT_DISPLAY_MODE_GLOBAL,
208 RIFT_DISPLAY_MODE_ROLLING_TOP_BOTTOM,
209 RIFT_DISPLAY_MODE_ROLLING_LEFT_RIGHT,
210 RIFT_DISPLAY_MODE_ROLLING_RIGHT_LEFT,
213enum rift_display_limit
215 RIFT_DISPLAY_LIMIT_ACL_OFF = 0,
216 RIFT_DISPLAY_LIMIT_ACL_30 = 1,
217 RIFT_DISPLAY_LIMIT_ACL_25 = 2,
218 RIFT_DISPLAY_LIMIT_ACL_50 = 3,
221enum rift_display_flags
223 RIFT_DISPLAY_USE_ROLLING = 1 << 6,
224 RIFT_DISPLAY_REVERSE_ROLLING = 1 << 7,
225 RIFT_DISPLAY_HIGH_BRIGHTNESS = 1 << 8,
226 RIFT_DISPLAY_SELF_REFRESH = 1 << 9,
227 RIFT_DISPLAY_READ_PIXEL = 1 << 10,
228 RIFT_DISPLAY_DIRECT_PENTILE = 1 << 11,
248 uint16_t persistence;
251 uint16_t lighting_offset;
253 uint16_t pixel_settle;
270#define DK2_MAX_SAMPLES 2
275 uint16_t sample_count;
276 uint16_t temperature;
277 uint32_t sample_timestamp;
282 uint16_t frame_count;
283 uint32_t frame_timestamp;
285 uint8_t tracking_pattern;
286 uint16_t tracking_count;
287 uint32_t tracking_timestamp;
297 float k[CATMULL_COEFFICIENTS];
299 float meters_per_tan_angle_at_center;
300 float chromatic_abberation[CHROMATIC_ABBERATION_COEFFEICENT_COUNT];
306 uint16_t distortion_version;
332 float screen_gap_meters;
334 float lens_diameter_meters;
351#define OCULUS_VR_VID 0x2833
353#define OCULUS_DK2_PID 0x0021
366 cJSON *attached_data,
387 bool processed_sample_packet;
388 uint32_t last_remote_sample_time_us;
389 int64_t last_remote_sample_time_ns;
394 int64_t last_keepalive_time;
395 enum rift_variant variant;
400 uint16_t num_lens_distortions;
401 uint16_t distortion_in_use;
414rift_hmd_create(
struct os_hid_device *dev,
enum rift_variant variant,
char *device_name,
char *serial_number);
u_logging_level
Logging level enum.
Definition: u_logging.h:44
C interface to math library.
A IMU fusion specially made for 3dof devices.
Wrapper header for <math.h> to ensure pi-related math constants are defined.
Wrapper around OS native hid functions.
Wrapper around OS threading native functions.
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:19
static struct rift_hmd * rift_hmd(struct xrt_device *xdev)
Casting helper function.
Definition: rift_interface.h:408
Definition: oh_device.c:483
Definition: rift_interface.h:272
Definition: rift_interface.h:199
Definition: rift_interface.h:265
Definition: rift_interface.h:260
Definition: m_space.cpp:87
Definition: m_clock_tracking.c:35
Definition: m_imu_3dof.h:35
Definition: m_relation_history.cpp:50
Representing a single hid interface on a device.
Definition: os_hid.h:29
All in one helper that handles locking, waiting for change and starting a thread.
Definition: os_threading.h:453
Definition: rift_interface.h:295
Definition: rift_interface.h:168
Definition: rift_interface.h:138
Definition: rift_interface.h:148
Definition: rift_interface.h:232
A rift HMD device.
Definition: rift_interface.h:375
Definition: rift_interface.h:180
Definition: rift_interface.h:304
Definition: rift_interface.h:316
Definition: rift_interface.h:322
A single HMD or input device.
Definition: xrt_device.h:281
A pose composed of a position and orientation.
Definition: xrt_defines.h:467
A probed device, may or may not be opened.
Definition: xrt_prober.h:85
The main prober that probes and manages found but not opened HMD devices that are connected to the sy...
Definition: xrt_prober.h:132
A 2 element vector with single floats.
Definition: xrt_defines.h:252
Misc helpers for device drivers.
Basic logging functionality.
Common defines and enums for XRT.
Header defining an xrt display or controller device.
Common interface to probe for devices.