target_lists.c 1.98 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
17
18
19
20
#include "target_lists.h"

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

#ifdef XRT_BUILD_OHMD
#include "ohmd/oh_interface.h"
#endif

Jakob Bornecrantz's avatar
Jakob Bornecrantz committed
21
22
23
24
#ifdef XRT_BUILD_PSMV
#include "psmv/psmv_interface.h"
#endif

25
26
27
28
#ifdef XRT_BUILD_PSVR
#include "psvr/psvr_interface.h"
#endif

29
30
31
32
#ifdef XRT_BUILD_HYDRA
#include "hydra/hydra_interface.h"
#endif

33

34
35
36
37
38
39
40
41
42
/*!
 * 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`
43
44
 * - `struct xrt_device **out_xdevs` (an array of XRT_MAX_DEVICES_PER_PROBE
 * xrt_device pointers)
45
46
 *
 * It is called when devices[index] match the VID and PID in the list.
47
48
49
 * 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.
50
 */
51
struct xrt_prober_entry target_entry_list[] = {
52
#ifdef XRT_BUILD_PSMV
Jakob Bornecrantz's avatar
Jakob Bornecrantz committed
53
54
    {PSMV_VID, PSMV_PID, psmv_found, "PS Move"},
#endif
55
56
57
58
59

#ifdef XRT_BUILD_HYDRA
    {HYDRA_VID, HYDRA_PID, hydra_found, "Razer Hydra"},
#endif

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
    {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_HDK
    hdk_create_auto_prober,
#endif

#ifdef XRT_BUILD_PSVR
    psvr_create_auto_prober,
#endif

#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,
};