Monado OpenXR Runtime
wmr_controller_base.c File Reference

Driver for WMR Controller. More...

#include "os/os_time.h"
#include "os/os_hid.h"
#include "math/m_mathinclude.h"
#include "math/m_api.h"
#include "math/m_clock_tracking.h"
#include "math/m_vec2.h"
#include "math/m_predict.h"
#include "util/u_file.h"
#include "util/u_var.h"
#include "util/u_misc.h"
#include "util/u_time.h"
#include "util/u_debug.h"
#include "util/u_device.h"
#include "util/u_trace_marker.h"
#include "wmr_common.h"
#include "wmr_controller_base.h"
#include "wmr_config_key.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
Include dependency graph for wmr_controller_base.c:

Macros

#define WMR_TRACE(wcb, ...)   U_LOG_XDEV_IFL_T(&wcb->base, wcb->log_level, __VA_ARGS__)
 
#define WMR_TRACE_HEX(wcb, ...)   U_LOG_XDEV_IFL_T_HEX(&wcb->base, wcb->log_level, __VA_ARGS__)
 
#define WMR_DEBUG(wcb, ...)   U_LOG_XDEV_IFL_D(&wcb->base, wcb->log_level, __VA_ARGS__)
 
#define WMR_DEBUG_HEX(wcb, ...)   U_LOG_XDEV_IFL_D_HEX(&wcb->base, wcb->log_level, __VA_ARGS__)
 
#define WMR_INFO(wcb, ...)   U_LOG_XDEV_IFL_I(&wcb->base, wcb->log_level, __VA_ARGS__)
 
#define WMR_WARN(wcb, ...)   U_LOG_XDEV_IFL_W(&wcb->base, wcb->log_level, __VA_ARGS__)
 
#define WMR_ERROR(wcb, ...)   U_LOG_XDEV_IFL_E(&wcb->base, wcb->log_level, __VA_ARGS__)
 
#define wmr_controller_hexdump_buffer(wcb, label, buf, length)
 

Functions

static struct wmr_controller_basewmr_controller_base (struct xrt_device *p)
 
static void receive_bytes (struct wmr_controller_base *wcb, uint64_t time_ns, uint8_t *buffer, uint32_t buf_size)
 
static bool wmr_controller_send_bytes (struct wmr_controller_base *wcb, const uint8_t *buffer, uint32_t buf_size)
 
static int wmr_controller_read_sync (struct wmr_controller_base *wcb, uint8_t *buffer, uint32_t buf_size, int timeout_ms)
 
static int wmr_controller_send_fw_cmd (struct wmr_controller_base *wcb, const struct wmr_controller_fw_cmd *fw_cmd, unsigned char response_code, struct wmr_controller_fw_cmd_response *response)
 
static XRT_MAYBE_UNUSED int wmr_read_fw_block (struct wmr_controller_base *d, uint8_t blk_id, uint8_t **out_data, size_t *out_size)
 
static bool read_controller_fw_info (struct wmr_controller_base *wcb, uint32_t *fw_revision, uint16_t *calibration_size, char serial_no[16])
 
char * build_cache_filename (char *serial_no)
 
static bool read_calibration_cache (struct wmr_controller_base *wcb, char *cache_filename)
 
static void write_calibration_cache (struct wmr_controller_base *wcb, char *cache_filename, uint8_t *data, size_t data_size)
 
static bool read_controller_config (struct wmr_controller_base *wcb)
 
static xrt_result_t wmr_controller_base_get_tracked_pose (struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
 
void wmr_controller_base_deinit (struct wmr_controller_base *wcb)
 
bool wmr_controller_base_init (struct wmr_controller_base *wcb, struct wmr_controller_connection *conn, enum xrt_device_type controller_type, enum u_logging_level log_level)
 

Detailed Description

Driver for WMR Controller.

Author
Jan Schmidt jan@c.nosp@m.entr.nosp@m.icula.nosp@m.r.co.nosp@m.m

Macro Definition Documentation

◆ wmr_controller_hexdump_buffer

#define wmr_controller_hexdump_buffer (   wcb,
  label,
  buf,
  length 
)
Value:
do { \
WMR_DEBUG(wcb, "%s", label); \
WMR_DEBUG_HEX(wcb, buf, length); \
} while (0);