Monado OpenXR Runtime
Loading...
Searching...
No Matches
rift_radio.c File Reference

Radio state machine functions for the Oculus Rift. More...

#include "util/u_device.h"
#include "util/u_var.h"
#include "util/u_file.h"
#include "xrt/xrt_byte_order.h"
#include "rift_radio.h"
#include "rift_bindings.h"
#include "rift_usb.h"
#include <errno.h>
Include dependency graph for rift_radio.c:

Macros

#define SET_INPUT(NAME)
 
#define SET_INPUT(NAME, ACTIVE)
 
#define RIFT_TOUCH_CONTROLLER_CALIBRATION_FILENAME_MAX_LEN   (XRT_DEVICE_NAME_LEN + 13)
 

Functions

static void rift_update_input (struct xrt_device *device, size_t index, union xrt_input_value value, int64_t now)
 
static xrt_result_t rift_touch_controller_get_tracked_pose (struct xrt_device *xdev, const enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
 
static void rift_touch_controller_destroy (struct xrt_device *xdev)
 
static xrt_result_t rift_touch_controller_update_inputs (struct xrt_device *xdev)
 
static xrt_result_t rift_touch_controller_set_output (struct xrt_device *xdev, enum xrt_output_name name, const struct xrt_output_value *value)
 
static xrt_result_t rift_touch_controller_get_battery_status (struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge)
 
static xrt_result_t rift_remote_get_tracked_pose (struct xrt_device *xdev, const enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
 
static void rift_remote_destroy (struct xrt_device *xdev)
 
static xrt_result_t rift_remote_update_inputs (struct xrt_device *xdev)
 
static struct rift_remoterift_remote_create (struct rift_hmd *hmd)
 
static struct rift_touch_controllerrift_touch_controller_create (struct rift_hmd *hmd, enum rift_radio_device_type device_type)
 
static int rift_radio_read_device_serial_async_locked (struct rift_hmd *hmd, enum rift_radio_device_type device_type, char serial[14], bool *serial_valid)
 
static int rift_radio_read_device_flash_async_locked (struct rift_hmd *hmd, void *user_data, enum rift_radio_device_type device_type, uint16_t offset, uint16_t length, uint8_t *buffer, flash_read_callback_t callback)
 
static int rift_touch_controller_calibration_body_read_callback (void *user_data, uint16_t address, uint16_t length)
 
static int rift_touch_controller_calibration_read_body_async_locked (struct rift_touch_controller *controller, uint16_t address)
 
static void rift_touch_controller_get_calibration_filename (struct rift_touch_controller *controller, char *out_filename)
 
static int rift_touch_controller_calibration_hash_read_callback (void *user_data, uint16_t address, uint16_t length)
 
static int rift_radio_read_touch_calibration_hash_async_locked (struct rift_hmd *hmd, struct rift_touch_controller *controller)
 
bool rift_radio_read_device_serial (struct rift_hmd *hmd, enum rift_radio_device_type device_type, char *serial, bool *serial_valid)
 
static bool rift_radio_read_controller_calibration (struct rift_hmd *hmd, struct rift_touch_controller *controller)
 
static void rift_touch_controller_handle_radio_input_report (struct rift_hmd *hmd, struct rift_touch_controller *controller, struct rift_radio_report_message message, int64_t receive_ns)
 
int rift_radio_handle_read (struct rift_hmd *hmd)
 
static int rift_radio_set_touch_controller_haptics_sync (struct rift_hmd *hmd, enum rift_radio_device_type device_type, bool high_freq, uint8_t amplitude)
 
static int rift_radio_update_touch_haptics (struct rift_hmd *hmd, enum rift_radio_device_type device_type, timepoint_ns now)
 
int rift_radio_handle_haptics (struct rift_hmd *hmd)
 
int rift_radio_handle_command (struct rift_hmd *hmd)
 

Detailed Description

Radio state machine functions for the Oculus Rift.

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

Macro Definition Documentation

◆ SET_INPUT [1/2]

#define SET_INPUT (   NAME)
Value:
do { \
remote->base.inputs[RIFT_REMOTE_INPUT_##NAME].name = XRT_INPUT_RIFT_REMOTE_##NAME##_CLICK; \
} while (0)

◆ SET_INPUT [2/2]

#define SET_INPUT (   NAME,
  ACTIVE 
)
Value:
do { \
if (ACTIVE) { \
controller->base.inputs[RIFT_TOUCH_CONTROLLER_INPUT_##NAME].name = XRT_INPUT_TOUCH_##NAME; \
controller->base.inputs[RIFT_TOUCH_CONTROLLER_INPUT_##NAME].active = ACTIVE; \
} \
} while (0)