Monado OpenXR Runtime

Main prober code. More...

#include "xrt/xrt_config_drivers.h"
#include "xrt/xrt_system.h"
#include "xrt/xrt_settings.h"
#include "util/u_var.h"
#include "util/u_misc.h"
#include "util/u_config_json.h"
#include "util/u_debug.h"
#include "util/u_pretty_print.h"
#include "util/u_trace_marker.h"
#include "os/os_hid.h"
#include "p_prober.h"
#include "v4l2/v4l2_interface.h"
#include "realsense/rs_interface.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "multi_wrapper/multi.h"
Include dependency graph for p_prober.c:

Macros

#define num_driver_conflicts   1
 
#define PH(IDENT)
 
#define P(IDENT)   u_pp(dg, "\n\t\t%s: %s", #IDENT, xsysd->static_roles.IDENT ? xsysd->static_roles.IDENT->str : "<none>")
 
#define PD(IDENT)   u_pp(dg, "\n\t\t%s: %s", #IDENT, roles.IDENT >= 0 ? xsysd->xdevs[roles.IDENT]->str : "<none>")
 

Functions

static void add_device (struct prober *p, struct prober_device **out_dev)
 
static int initialize (struct prober *p, struct xrt_prober_entry_lists *lists)
 
static void teardown_devices (struct prober *p)
 
static void teardown (struct prober *p)
 
static xrt_result_t p_probe (struct xrt_prober *xp)
 
static xrt_result_t p_lock_list (struct xrt_prober *xp, struct xrt_prober_device ***out_devices, size_t *out_device_count)
 
static xrt_result_t p_unlock_list (struct xrt_prober *xp, struct xrt_prober_device ***devices)
 
static int p_dump (struct xrt_prober *xp, bool use_stdout)
 
static xrt_result_t p_create_system (struct xrt_prober *xp, struct xrt_session_event_sink *broadcast, struct xrt_system_devices **out_xsysd, struct xrt_space_overseer **out_xso)
 
static int p_select_device (struct xrt_prober *xp, struct xrt_device **xdevs, size_t xdev_count)
 
static int p_open_hid_interface (struct xrt_prober *xp, struct xrt_prober_device *xpdev, int interface, struct os_hid_device **out_hid_dev)
 
static int p_open_video_device (struct xrt_prober *xp, struct xrt_prober_device *xpdev, struct xrt_frame_context *xfctx, struct xrt_fs **out_xfs)
 
static int p_list_video_devices (struct xrt_prober *xp, xrt_prober_list_video_func_t cb, void *ptr)
 
static int p_get_builders (struct xrt_prober *xp, size_t *out_builder_count, struct xrt_builder ***out_builders, size_t *out_num_entries, struct xrt_prober_entry ***out_entries, struct xrt_auto_prober ***out_auto_probers)
 
static int p_get_string_descriptor (struct xrt_prober *xp, struct xrt_prober_device *xpdev, enum xrt_prober_string which_string, unsigned char *buffer, size_t length)
 
static bool p_can_open (struct xrt_prober *xp, struct xrt_prober_device *xpdev)
 
static void p_destroy (struct xrt_prober **xp)
 
int xrt_prober_create_with_lists (struct xrt_prober **out_xp, struct xrt_prober_entry_lists *lists)
 
int p_dev_get_usb_dev (struct prober *p, uint16_t bus, uint16_t addr, uint16_t vendor_id, uint16_t product_id, struct prober_device **out_pdev)
 
int p_dev_get_bluetooth_dev (struct prober *p, uint64_t id, uint16_t vendor_id, uint16_t product_id, const char *product_name, struct prober_device **out_pdev)
 
static void fill_out_product (struct prober *p, struct prober_device *pdev)
 
static void add_usb_entry (struct prober *p, struct xrt_prober_entry *entry)
 
static void add_builder (struct prober *p, struct xrt_builder *xb)
 
static int collect_entries (struct prober *p)
 
static void disable_drivers_from_conflicts (struct prober *p)
 
static void parse_disabled_drivers (struct prober *p)
 
static void handle_found_device (struct prober *p, struct xrt_device **xdevs, size_t xdev_count, bool *have_hmd, struct xrt_device *xdev)
 
static void add_from_devices (struct prober *p, struct xrt_device **xdevs, size_t xdev_count, bool *have_hmd)
 
static void add_from_auto_probers (struct prober *p, struct xrt_device **xdevs, size_t xdev_count, bool *have_hmd)
 
static void apply_tracking_override (struct prober *p, struct xrt_device **xdevs, size_t xdev_count, struct xrt_tracking_override *o)
 
struct xrt_builderfind_builder_by_identifier (struct prober *p, const char *ident)
 
static void print_system_devices (u_pp_delegate_t dg, struct xrt_system_devices *xsysd)
 

Variables

char * driver_conflicts [1][2] = {{"survive", "vive"}}
 

Detailed Description

Macro Definition Documentation

◆ PH

#define PH (   IDENT)
Value:
u_pp(dg, "\n\t\t%s: %s, view count: %zu", #IDENT, \
xsysd->static_roles.IDENT ? xsysd->static_roles.IDENT->str : "<none>", \
xsysd->static_roles.IDENT ? xsysd->static_roles.IDENT->hmd->view_count : 0u);
void u_pp(struct u_pp_delegate dg, const char *fmt,...) XRT_PRINTF_FORMAT(2
Formats a string and sends to the delegate.

Function Documentation

◆ p_can_open()

static bool p_can_open ( struct xrt_prober xp,
struct xrt_prober_device xpdev 
)
static
Todo:
add more backends

◆ p_create_system()

static xrt_result_t p_create_system ( struct xrt_prober xp,
struct xrt_session_event_sink broadcast,
struct xrt_system_devices **  out_xsysd,
struct xrt_space_overseer **  out_xso 
)
static
Todo:
Improve estimation selection logic.

◆ p_get_string_descriptor()

static int p_get_string_descriptor ( struct xrt_prober xp,
struct xrt_prober_device xpdev,
enum xrt_prober_string  which_string,
unsigned char *  buffer,
size_t  length 
)
static
Todo:
add more backends
Todo:
Todo:
make this unicode (utf-16)? utf-8 would be better...

◆ teardown_devices()

static void teardown_devices ( struct prober p)
static
Todo:
Free somewhere else
Todo:
Free somewhere else