Monado OpenXR Runtime
rift_interface.h File Reference

Interface to Oculus Rift driver code. More...

#include "xrt/xrt_device.h"
#include "xrt/xrt_defines.h"
#include "xrt/xrt_prober.h"
#include "os/os_hid.h"
#include "os/os_threading.h"
#include "util/u_device.h"
#include "util/u_logging.h"
#include "math/m_imu_3dof.h"
#include "math/m_api.h"
#include "math/m_mathinclude.h"
#include <stdlib.h>
#include <stdio.h>
Include dependency graph for rift_interface.h:

Go to the source code of this file.

Data Structures

struct  rift_config_report
 
struct  rift_display_info_report
 
struct  rift_catmull_rom_distortion_report_data
 
struct  rift_lens_distortion_report
 
struct  dk2_report_keepalive_mux
 
struct  rift_display_report
 
struct  dk2_sensor_sample
 
struct  dk2_sample_pack
 
struct  dk2_in_report
 
struct  rift_catmull_rom_distortion_data
 
struct  rift_lens_distortion
 
struct  rift_scale_and_offset
 
struct  rift_viewport_fov_tan
 
struct  rift_extra_display_info
 
struct  rift_hmd
 A rift HMD device. More...
 

Macros

#define REPORT_MAX_SIZE   69
 
#define KEEPALIVE_INTERVAL_NS   10000000000
 
#define KEEPALIVE_SEND_RATE_NS   ((KEEPALIVE_INTERVAL_NS * 19) / 20)
 
#define IMU_SAMPLE_RATE   (1000)
 
#define NS_PER_SAMPLE   (1000 * 1000)
 
#define DEG_TO_RAD(DEG)   (DEG * M_PI / 180.0)
 
#define MICROMETERS_TO_METERS(microns)   (float)microns / 1000000.0f
 
#define DEFAULT_EXTRA_EYE_ROTATION   DEG_TO_RAD(30.0f)
 
#define IN_REPORT_DK2   11
 
#define CATMULL_COEFFICIENTS   11
 
#define CHROMATIC_ABBERATION_COEFFEICENT_COUNT   4
 
#define RIFT_PACKED
 
#define DK2_MAX_SAMPLES   2
 
#define OCULUS_VR_VID   0x2833
 
#define OCULUS_DK2_PID   0x0021
 

Enumerations

enum  rift_feature_reports {
  FEATURE_REPORT_CONFIG = 2 , FEATURE_REPORT_CALIBRATE = 3 , FEATURE_REPORT_RANGE = 4 , FEATURE_REPORT_REGISTER = 5 ,
  FEATURE_REPORT_DFU = 6 , FEATURE_REPORT_DK1_KEEP_ALIVE = 8 , FEATURE_REPORT_DISPLAY_INFO = 9 , FEATURE_REPORT_SERIAL = 10 ,
  FEATURE_REPORT_TRACKING = 12 , FEATURE_REPORT_DISPLAY = 13 , FEATURE_REPORT_MAG_CALIBRATION = 14 , FEATURE_REPORT_POS_CALIBRATION = 15 ,
  FEATURE_REPORT_CUSTOM_PATTERN = 16 , FEATURE_REPORT_KEEPALIVE_MUX = 17 , FEATURE_REPORT_MANUFACTURING = 18 , FEATURE_REPORT_UUID = 19 ,
  FEATURE_REPORT_TEMPERATURE = 20 , FEATURE_REPORT_GYROOFFSET = 21 , FEATURE_REPORT_LENS_DISTORTION = 22
}
 
enum  rift_config_report_flags {
  RIFT_CONFIG_REPORT_USE_RAW = 1 , RIFT_CONFIG_REPORT_INTERNAL_CALIBRATION = 1 << 1 , RIFT_CONFIG_REPORT_USE_CALIBRATION = 1 << 2 , RIFT_CONFIG_REPORT_AUTO_CALIBRATION = 1 << 3 ,
  RIFT_CONFIG_REPORT_MOTION_KEEP_ALIVE = 1 << 4 , RIFT_CONFIG_REPORT_COMMAND_KEEP_ALIVE = 1 << 5 , RIFT_CONFIG_REPORT_USE_SENSOR_COORDINATES = 1 << 6 , RIFT_CONFIG_REPORT_OVERRIDE_POWER = 1 << 7
}
 
enum  rift_distortion_type { RIFT_DISTORTION_TYPE_DIMS = 1 , RIFT_DISTORTION_TYPE_K = 2 }
 
enum  rift_lens_type { RIFT_LENS_TYPE_A = 0 , RIFT_LENS_TYPE_B = 1 }
 
enum  rift_lens_distortion_version { RIFT_LENS_DISTORTION_NONE = 0 , RIFT_LENS_DISTORTION_LCSV_CATMULL_ROM_10_VERSION_1 = 1 }
 
enum  rift_display_mode { RIFT_DISPLAY_MODE_GLOBAL , RIFT_DISPLAY_MODE_ROLLING_TOP_BOTTOM , RIFT_DISPLAY_MODE_ROLLING_LEFT_RIGHT , RIFT_DISPLAY_MODE_ROLLING_RIGHT_LEFT }
 
enum  rift_display_limit { RIFT_DISPLAY_LIMIT_ACL_OFF = 0 , RIFT_DISPLAY_LIMIT_ACL_30 = 1 , RIFT_DISPLAY_LIMIT_ACL_25 = 2 , RIFT_DISPLAY_LIMIT_ACL_50 = 3 }
 
enum  rift_display_flags {
  RIFT_DISPLAY_USE_ROLLING = 1 << 6 , RIFT_DISPLAY_REVERSE_ROLLING = 1 << 7 , RIFT_DISPLAY_HIGH_BRIGHTNESS = 1 << 8 , RIFT_DISPLAY_SELF_REFRESH = 1 << 9 ,
  RIFT_DISPLAY_READ_PIXEL = 1 << 10 , RIFT_DISPLAY_DIRECT_PENTILE = 1 << 11
}
 
enum  rift_variant { RIFT_VARIANT_DK1 , RIFT_VARIANT_DK2 }
 

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. More...
 
static struct rift_hmdrift_hmd (struct xrt_device *xdev)
 Casting helper function. More...
 
struct rift_hmdrift_hmd_create (struct os_hid_device *dev, enum rift_variant variant, char *device_name, char *serial_number)
 

Detailed Description

Interface to Oculus Rift driver code.

Author
Beyley Cardellion ep1cm.nosp@m.1n10.nosp@m.n123@.nosp@m.gmai.nosp@m.l.com

Function Documentation

◆ rift_found()

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.

See also
xrt_prober_found_func_t

References xrt_prober::xrt_prober_get_string_descriptor().

◆ rift_hmd()

static struct rift_hmd * rift_hmd ( struct xrt_device xdev)
inlinestatic

Casting helper function.