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 MICROMETERS_TO_METERS(microns) (float)microns / 1000000.0f
43#define DEFAULT_EXTRA_EYE_ROTATION DEG_TO_RAD(30.0f)
45enum rift_feature_reports
48 FEATURE_REPORT_CONFIG = 2,
49 FEATURE_REPORT_CALIBRATE = 3,
50 FEATURE_REPORT_RANGE = 4,
51 FEATURE_REPORT_REGISTER = 5,
52 FEATURE_REPORT_DFU = 6,
53 FEATURE_REPORT_DK1_KEEP_ALIVE = 8,
54 FEATURE_REPORT_DISPLAY_INFO = 9,
55 FEATURE_REPORT_SERIAL = 10,
58 FEATURE_REPORT_TRACKING = 12,
59 FEATURE_REPORT_DISPLAY = 13,
60 FEATURE_REPORT_MAG_CALIBRATION = 14,
61 FEATURE_REPORT_POS_CALIBRATION = 15,
62 FEATURE_REPORT_CUSTOM_PATTERN = 16,
63 FEATURE_REPORT_KEEPALIVE_MUX = 17,
64 FEATURE_REPORT_MANUFACTURING = 18,
65 FEATURE_REPORT_UUID = 19,
66 FEATURE_REPORT_TEMPERATURE = 20,
67 FEATURE_REPORT_GYROOFFSET = 21,
68 FEATURE_REPORT_LENS_DISTORTION = 22,
71enum rift_config_report_flags
74 RIFT_CONFIG_REPORT_USE_RAW = 1,
76 RIFT_CONFIG_REPORT_INTERNAL_CALIBRATION = 1 << 1,
78 RIFT_CONFIG_REPORT_USE_CALIBRATION = 1 << 2,
80 RIFT_CONFIG_REPORT_AUTO_CALIBRATION = 1 << 3,
82 RIFT_CONFIG_REPORT_MOTION_KEEP_ALIVE = 1 << 4,
84 RIFT_CONFIG_REPORT_COMMAND_KEEP_ALIVE = 1 << 5,
87 RIFT_CONFIG_REPORT_USE_SENSOR_COORDINATES = 1 << 6,
90 RIFT_CONFIG_REPORT_OVERRIDE_POWER = 1 << 7,
93enum rift_distortion_type
95 RIFT_DISTORTION_TYPE_DIMS = 1,
96 RIFT_DISTORTION_TYPE_K = 2,
102 RIFT_LENS_TYPE_A = 0,
104 RIFT_LENS_TYPE_B = 1,
107#define IN_REPORT_DK2 11
109#define CATMULL_COEFFICIENTS 11
110#define CHROMATIC_ABBERATION_COEFFEICENT_COUNT 4
112enum rift_lens_distortion_version
115 RIFT_LENS_DISTORTION_NONE = 0,
117 RIFT_LENS_DISTORTION_LCSV_CATMULL_ROM_10_VERSION_1 = 1,
127#define RIFT_PACKED __attribute__((packed))
139 uint8_t config_flags;
143 uint16_t sample_rate;
149 uint8_t distortion_type;
151 uint16_t resolution_x;
153 uint16_t resolution_y;
155 uint32_t display_width;
157 uint32_t display_height;
161 uint32_t lens_separation;
162 uint32_t lens_distance[2];
171 uint16_t k[CATMULL_COEFFICIENTS];
173 uint16_t meters_per_tan_angle_at_center;
174 uint16_t chromatic_abberation[CHROMATIC_ABBERATION_COEFFEICENT_COUNT];
182 uint8_t num_distortions;
184 uint8_t distortion_idx;
190 uint16_t distortion_version;
204enum rift_display_mode
206 RIFT_DISPLAY_MODE_GLOBAL,
207 RIFT_DISPLAY_MODE_ROLLING_TOP_BOTTOM,
208 RIFT_DISPLAY_MODE_ROLLING_LEFT_RIGHT,
209 RIFT_DISPLAY_MODE_ROLLING_RIGHT_LEFT,
212enum rift_display_limit
214 RIFT_DISPLAY_LIMIT_ACL_OFF = 0,
215 RIFT_DISPLAY_LIMIT_ACL_30 = 1,
216 RIFT_DISPLAY_LIMIT_ACL_25 = 2,
217 RIFT_DISPLAY_LIMIT_ACL_50 = 3,
220enum rift_display_flags
222 RIFT_DISPLAY_USE_ROLLING = 1 << 6,
223 RIFT_DISPLAY_REVERSE_ROLLING = 1 << 7,
224 RIFT_DISPLAY_HIGH_BRIGHTNESS = 1 << 8,
225 RIFT_DISPLAY_SELF_REFRESH = 1 << 9,
226 RIFT_DISPLAY_READ_PIXEL = 1 << 10,
227 RIFT_DISPLAY_DIRECT_PENTILE = 1 << 11,
247 uint16_t persistence;
250 uint16_t lighting_offset;
252 uint16_t pixel_settle;
269#define DK2_MAX_SAMPLES 2
274 uint16_t sample_count;
275 uint16_t temperature;
276 uint32_t sample_timestamp;
281 uint16_t frame_count;
282 uint32_t frame_timestamp;
284 uint8_t tracking_pattern;
285 uint16_t tracking_count;
286 uint32_t tracking_timestamp;
296 float k[CATMULL_COEFFICIENTS];
298 float meters_per_tan_angle_at_center;
299 float chromatic_abberation[CHROMATIC_ABBERATION_COEFFEICENT_COUNT];
305 uint16_t distortion_version;
331 float screen_gap_meters;
333 float lens_diameter_meters;
350#define OCULUS_VR_VID 0x2833
352#define OCULUS_DK2_PID 0x0021
365 cJSON *attached_data,
386 bool processed_sample_packet;
387 uint32_t last_remote_sample_time_us;
388 int64_t last_remote_sample_time_ns;
393 int64_t last_keepalive_time;
394 enum rift_variant variant;
399 uint16_t num_lens_distortions;
400 uint16_t distortion_in_use;
413rift_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:45
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:407
Definition: oh_device.c:483
Definition: rift_interface.h:271
Definition: rift_interface.h:198
Definition: rift_interface.h:264
Definition: rift_interface.h:259
Definition: m_space.cpp:87
Definition: m_clock_tracking.c:35
Definition: m_imu_3dof.h:35
Definition: m_relation_history.cpp:49
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:465
Definition: rift_interface.h:294
Definition: rift_interface.h:167
Definition: rift_interface.h:137
Definition: rift_interface.h:147
Definition: rift_interface.h:231
A rift HMD device.
Definition: rift_interface.h:374
Definition: rift_interface.h:179
Definition: rift_interface.h:303
Definition: rift_interface.h:315
Definition: rift_interface.h:321
A single HMD or input device.
Definition: xrt_device.h:309
A pose composed of a position and orientation.
Definition: xrt_defines.h:479
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:268
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.