target_lists.c 2.19 KB
Newer Older
1 2 3 4 5 6 7 8
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
 * @file
 * @brief  Common things to pull into a target.
 * @author Jakob Bornecrantz <jakob@collabora.com>
 */

9 10
#include "targets_enabled_drivers.h"

11 12 13 14 15 16
#include "target_lists.h"

#ifdef XRT_BUILD_HDK
#include "hdk/hdk_interface.h"
#endif

17 18 19 20
#ifdef XRT_BUILD_SURVIVE
#include "survive/survive_interface.h"
#endif

21 22 23 24
#ifdef XRT_BUILD_OHMD
#include "ohmd/oh_interface.h"
#endif

25 26 27 28
#ifdef XRT_BUILD_PSMV
#include "psmv/psmv_interface.h"
#endif

29 30 31 32
#ifdef XRT_BUILD_PSVR
#include "psvr/psvr_interface.h"
#endif

33 34 35 36
#ifdef XRT_BUILD_HYDRA
#include "hydra/hydra_interface.h"
#endif

37

38 39 40 41 42 43 44 45 46
/*!
 * Each entry should be a vendor ID (VID), product ID (PID), a "found" function,
 * and a string literal name.
 *
 * The "found" function must return `int` and take as parameters:
 *
 * - `struct xrt_prober *xp`
 * - `struct xrt_prober_device **devices`
 * - `size_t index`
47 48
 * - `struct xrt_device **out_xdevs` (an array of XRT_MAX_DEVICES_PER_PROBE
 * xrt_device pointers)
49 50
 *
 * It is called when devices[index] match the VID and PID in the list.
51 52 53
 * It should return 0 if it decides not to create any devices, negative on
 * error, and the number of devices created if it creates one or more: it should
 * assign sequential elements of out_xdevs to the created devices.
54
 */
55
struct xrt_prober_entry target_entry_list[] = {
56
#ifdef XRT_BUILD_PSMV
57
    {PSMV_VID, PSMV_PID, psmv_found, "PS Move"},
58
#endif // XRT_BUILD_PSMV
59 60 61

#ifdef XRT_BUILD_HYDRA
    {HYDRA_VID, HYDRA_PID, hydra_found, "Razer Hydra"},
62 63 64 65 66
#endif // XRT_BUILD_HYDRA

#ifdef XRT_BUILD_HDK
    {HDK_VID, HDK_PID, hdk_found, "OSVR HDK"},
#endif // XRT_BUILD_HDK
67

68 69 70 71 72 73 74 75 76 77 78 79 80
    {0x0000, 0x0000, NULL, NULL}, // Terminate
};

struct xrt_prober_entry *target_entry_lists[] = {
    target_entry_list,
    NULL, // Terminate
};

xrt_auto_prober_creator target_auto_list[] = {
#ifdef XRT_BUILD_PSVR
    psvr_create_auto_prober,
#endif

81 82 83 84
#ifdef XRT_BUILD_SURVIVE
    survive_create_auto_prober,
#endif

85 86 87 88 89 90 91 92 93 94 95 96
#ifdef XRT_BUILD_OHMD
    // OpenHMD last as we want to override it with native drivers.
    oh_create_auto_prober,
#endif
    NULL, // Terminate
};

struct xrt_prober_entry_lists target_lists = {
    target_entry_lists,
    target_auto_list,
    NULL,
};