Monado OpenXR Runtime
blubur_s1_hmd.c File Reference

Implementation of Blubur S1 HMD driver. More...

#include "math/m_api.h"
#include "math/m_mathinclude.h"
#include "math/m_clock_tracking.h"
#include "util/u_device.h"
#include "util/u_distortion_mesh.h"
#include "util/u_misc.h"
#include "util/u_time.h"
#include "util/u_debug.h"
#include "util/u_trace_marker.h"
#include "util/u_linux.h"
#include "util/u_var.h"
#include "blubur_s1_interface.h"
#include "blubur_s1_internal.h"
#include "blubur_s1_protocol.h"
Include dependency graph for blubur_s1_hmd.c:

Data Structures

struct  read_context
 
struct  blubur_s1_decoded_sample
 

Macros

#define S1_TRACE(d, ...)   U_LOG_XDEV_IFL_T(&d->base, d->log_level, __VA_ARGS__)
 
#define S1_DEBUG(d, ...)   U_LOG_XDEV_IFL_D(&d->base, d->log_level, __VA_ARGS__)
 
#define S1_DEBUG_HEX(d, data, data_size)   U_LOG_XDEV_IFL_D_HEX(&d->base, d->log_level, data, data_size)
 
#define S1_INFO(d, ...)   U_LOG_XDEV_IFL_I(&d->base, d->log_level, __VA_ARGS__)
 
#define S1_WARN(d, ...)   U_LOG_XDEV_IFL_W(&d->base, d->log_level, __VA_ARGS__)
 
#define S1_ERROR(d, ...)   U_LOG_XDEV_IFL_E(&d->base, d->log_level, __VA_ARGS__)
 
#define VIEW_SIZE   (1440)
 
#define PANEL_WIDTH   (VIEW_SIZE * 2)
 
#define READ_STRUCTURE(ctx, dst)   read_into(ctx, dst, sizeof(*dst))
 

Functions

static struct blubur_s1_hmdblubur_s1_hmd (struct xrt_device *xdev)
 
static void blubur_s1_hmd_destroy (struct xrt_device *xdev)
 
static xrt_result_t blubur_s1_hmd_compute_poly_3k_distortion (struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
 
static xrt_result_t blubur_s1_hmd_compute_test_distortion (struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
 
static xrt_result_t blubur_s1_hmd_update_inputs (struct xrt_device *xdev)
 
static xrt_result_t blubur_s1_hmd_get_tracked_pose (struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
 
static xrt_result_t blubur_s1_hmd_get_presence (struct xrt_device *xdev, bool *presence)
 
static xrt_result_t blubur_s1_hmd_get_view_poses (struct xrt_device *xdev, const struct xrt_vec3 *default_eye_relation, int64_t at_timestamp_ns, uint32_t view_count, struct xrt_space_relation *out_head_relation, struct xrt_fov *out_fovs, struct xrt_pose *out_poses)
 
static void blubur_s1_hmd_fill_in_poly_3k (struct blubur_s1_hmd *hmd)
 
static void read_into (struct read_context *ctx, void *dest, size_t size)
 
static int32_t sign21 (uint32_t v)
 Sign-extend a 21-bit signed integer stored in a 32-bit unsigned integer. More...
 
static void blubur_s1_decode_triad (const uint8_t b[8], int32_t out_xyz[3])
 Decode 3×21-bit ints from 8 bytes (little-endian packing) More...
 
static void blubur_s1_decode_sample_pack (const uint8_t sample_pack[32], struct blubur_s1_decoded_sample out_samples[2])
 
static void blubur_s1_convert_accel_sample (const int32_t in[3], struct xrt_vec3 *out)
 
static void blubur_s1_convert_gyro_sample (const int32_t in[3], struct xrt_vec3 *out)
 
int blubur_s1_hmd_tick (struct blubur_s1_hmd *hmd)
 
static void * blubur_s1_hmd_thread (void *ptr)
 
struct blubur_s1_hmdblubur_s1_hmd_create (struct os_hid_device *dev, const char *serial)
 Creates a Blubur S1 HMD device from an opened HID handle. More...
 

Variables

static struct xrt_binding_input_pair vive_pro_inputs_blubur_s1_hmd [1]
 
static struct xrt_binding_profile blubur_s1_hmd_binding_profiles [2]
 

Detailed Description

Implementation of Blubur S1 HMD driver.

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

Function Documentation

◆ blubur_s1_decode_triad()

static void blubur_s1_decode_triad ( const uint8_t  b[8],
int32_t  out_xyz[3] 
)
static

Decode 3×21-bit ints from 8 bytes (little-endian packing)

References sign21().

◆ blubur_s1_hmd_create()

struct blubur_s1_hmd * blubur_s1_hmd_create ( struct os_hid_device dev,
const char *  serial 
)

Creates a Blubur S1 HMD device from an opened HID handle.

◆ sign21()

static int32_t sign21 ( uint32_t  v)
static

Sign-extend a 21-bit signed integer stored in a 32-bit unsigned integer.

Referenced by blubur_s1_decode_triad().

Variable Documentation

◆ blubur_s1_hmd_binding_profiles

struct xrt_binding_profile blubur_s1_hmd_binding_profiles[2]
static
Initial value:
= {
{
.name = XRT_DEVICE_VIVE_PRO,
.inputs = vive_pro_inputs_blubur_s1_hmd,
.input_count = ARRAY_SIZE(vive_pro_inputs_blubur_s1_hmd),
},
}
#define ARRAY_SIZE(a)
Array size helper.
Definition: xrt_compiler.h:56

◆ vive_pro_inputs_blubur_s1_hmd

struct xrt_binding_input_pair vive_pro_inputs_blubur_s1_hmd[1]
static
Initial value:
= {
{XRT_INPUT_VIVEPRO_SYSTEM_CLICK, XRT_INPUT_BLUBUR_S1_MENU_CLICK},
}