The open source OpenXR runtime
1// Copyright 2019-2024, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Common things to pull into a target.
6 * @author Jakob Bornecrantz <jakob@collabora.com>
7 */
8
9#include "xrt/xrt_config_drivers.h"
10
11#include "target_lists.h"
12#include "target_builder_interface.h"
13
14
15#ifdef XRT_BUILD_DRIVER_ARDUINO
16#include "arduino/arduino_interface.h"
17#endif
18
19#ifdef XRT_BUILD_DRIVER_BLUBUR_S1
20#include "blubur_s1/blubur_s1_interface.h"
21#endif
22
23#ifdef XRT_BUILD_DRIVER_SIMULATED
24#include "simulated/simulated_interface.h"
25#endif
26
27#ifdef XRT_BUILD_DRIVER_HDK
28#include "hdk/hdk_interface.h"
29#endif
30
31#ifdef XRT_BUILD_DRIVER_OHMD
32#include "ohmd/oh_interface.h"
33#endif
34
35#ifdef XRT_BUILD_DRIVER_PSMV
36#include "psmv/psmv_interface.h"
37#endif
38
39#ifdef XRT_BUILD_DRIVER_PSSENSE
40#include "pssense/pssense_interface.h"
41#endif
42
43#ifdef XRT_BUILD_DRIVER_PSVR
44#include "psvr/psvr_interface.h"
45#endif
46
47#ifdef XRT_BUILD_DRIVER_RIFT
48#include "rift/rift_interface.h"
49#endif
50
51#ifdef XRT_BUILD_DRIVER_RIFT_S
52#include "rift_s/rift_s_interface.h"
53#endif
54
55#ifdef XRT_BUILD_DRIVER_ROKID
56#include "rokid/rokid_interface.h"
57#endif
58
59#ifdef XRT_BUILD_DRIVER_HYDRA
60#include "hydra/hydra_interface.h"
61#endif
62
63#ifdef XRT_BUILD_DRIVER_DAYDREAM
64#include "daydream/daydream_interface.h"
65#endif
66
67#ifdef XRT_BUILD_DRIVER_ANDROID
68#include "android/android_prober.h"
69#endif
70
71#ifdef XRT_BUILD_DRIVER_ILLIXR
72#include "illixr/illixr_interface.h"
73#endif
74
75#ifdef XRT_BUILD_DRIVER_REALSENSE
76#include "realsense/rs_interface.h"
77#endif
78
79#ifdef XRT_BUILD_DRIVER_ULV2
80#include "ultraleap_v2/ulv2_interface.h"
81#endif
82
83#ifdef XRT_BUILD_DRIVER_ULV5
84#include "ultraleap_v5/ulv5_interface.h"
85#endif
86
87#ifdef XRT_BUILD_DRIVER_DEPTHAI
88#include "depthai/depthai_interface.h"
89#endif
90
91#ifdef XRT_BUILD_DRIVER_WMR
92#include "wmr/wmr_interface.h"
93#include "wmr/wmr_common.h"
94#endif
95
96#ifdef XRT_BUILD_DRIVER_XREAL_AIR
97#include "xreal_air/xreal_air_interface.h"
98#endif
99
100#ifdef XRT_BUILD_DRIVER_EUROC
101#include "euroc/euroc_interface.h"
102#endif
103
104#ifdef XRT_BUILD_DRIVER_HANDTRACKING
105#ifdef XRT_BUILD_DRIVER_DEPTHAI
106#include "ht/ht_interface.h"
107#endif
108#endif
109
110
111/*!
112 * Builders
113 */
114xrt_builder_create_func_t target_builder_list[] = {
115#ifdef T_BUILDER_QWERTY // High up to override any real hardware.
116 t_builder_qwerty_create,
117#endif // T_BUILDER_QWERTY
118
119#ifdef T_BUILDER_REMOTE // High up to override any real hardware.
120 t_builder_remote_create,
121#endif // T_BUILDER_REMOTE
122
123#ifdef T_BUILDER_SIMULATED // High up to override any real hardware.
124 t_builder_simulated_create,
125#endif // T_BUILDER_SIMULATED
126
127#ifdef XRT_BUILD_DRIVER_RIFT_S
128 rift_s_builder_create,
129#endif // XRT_BUILD_DRIVER_RIFT_S
130
131#ifdef T_BUILDER_RGB_TRACKING
132 t_builder_rgb_tracking_create,
133#endif // T_BUILDER_RGB_TRACKING
134
135#ifdef T_BUILDER_SIMULAVR
136 t_builder_simula_create,
137#endif // T_BUILDER_SIMULAVR
138
139#ifdef T_BUILDER_STEAMVR
140 t_builder_steamvr_create,
141#endif // T_BUILDER_STEAMVR
142
143#ifdef T_BUILDER_LIGHTHOUSE
144 t_builder_lighthouse_create,
145#endif // T_BUILDER_LIGHTHOUSE
146
147#ifdef T_BUILDER_NS
148 t_builder_north_star_create,
149#endif // T_BUILDER_NS
150
151#ifdef T_BUILDER_WMR
152 t_builder_wmr_create,
153#endif // T_BUILDER_WMR
154
155#ifdef XRT_BUILD_DRIVER_XREAL_AIR
156 xreal_air_builder_create,
157#endif // T_BUILDER_XREAL_AIR
158
159#ifdef T_BUILDER_LEGACY
160 t_builder_legacy_create,
161#endif // T_BUILDER_LEGACY
162
163 NULL,
164};
165
166
167/*!
168 * Each entry should be a vendor ID (VID), product ID (PID), a "found" function,
169 * and a string literal name.
170 *
171 * The "found" function must return `int` and take as parameters:
172 *
173 * - `struct xrt_prober *xp`
174 * - `struct xrt_prober_device **devices`
175 * - `size_t index`
176 * - `struct xrt_device **out_xdevs` (an array of XRT_MAX_DEVICES_PER_PROBE
177 * xrt_device pointers)
178 *
179 * It is called when devices[index] match the VID and PID in the list.
180 * It should return 0 if it decides not to create any devices, negative on
181 * error, and the number of devices created if it creates one or more: it should
182 * assign sequential elements of out_xdevs to the created devices.
183 */
184struct xrt_prober_entry target_entry_list[] = {
185#ifdef XRT_BUILD_DRIVER_PSMV
186 {PSMV_VID, PSMV_PID_ZCM1, psmv_found, "PS Move Controller (ZCM1)", "psmv"},
187 {PSMV_VID, PSMV_PID_ZCM2, psmv_found, "PS Move Controller (ZCM2)", "psmv"},
188#endif // XRT_BUILD_DRIVER_PSMV
189
190#ifdef XRT_BUILD_DRIVER_PSSENSE
191 {PSSENSE_VID, PSSENSE_PID_LEFT, pssense_found, "PlayStation VR2 Sense Controller (L)", "pssense"},
192 {PSSENSE_VID, PSSENSE_PID_RIGHT, pssense_found, "PlayStation VR2 Sense Controller (R)", "pssense"},
193#endif // XRT_BUILD_DRIVER_PSSENSE
194
195#ifdef XRT_BUILD_DRIVER_RIFT
196 {OCULUS_VR_VID, OCULUS_DK2_PID, rift_found, "Rift (DK2)", "rift"},
197#endif // XRT_BUILD_DRIVER_RIFT
198
199#ifdef XRT_BUILD_DRIVER_BLUBUR_S1
200 {BLUBUR_S1_VID, BLUBUR_S1_PID, blubur_s1_found, "Blubur S1", "blubur_s1"},
201#endif // XRT_BUILD_DRIVER_BLUBUR_S1
202
203#ifdef XRT_BUILD_DRIVER_ROKID
204 {ROKID_VID, ROKID_PID, rokid_found, "Rokid Air or Max", "rokid"},
205#endif // XRT_BUILD_DRIVER_ROKID
206
207#ifdef XRT_BUILD_DRIVER_HYDRA
208 {HYDRA_VID, HYDRA_PID, hydra_found, "Razer Hydra", "hydra"},
209#endif // XRT_BUILD_DRIVER_HYDRA
210
211#ifdef XRT_BUILD_DRIVER_HDK
212 {HDK_VID, HDK_PID, hdk_found, "OSVR HDK", "osvr"},
213#endif // XRT_BUILD_DRIVER_HDK
214
215 {0x0000, 0x0000, NULL, NULL, NULL}, // Terminate
216};
217
218struct xrt_prober_entry *target_entry_lists[] = {
219 target_entry_list,
220 NULL, // Terminate
221};
222
223xrt_auto_prober_create_func_t target_auto_list[] = {
224#ifdef XRT_BUILD_DRIVER_PSVR
225 psvr_create_auto_prober,
226#endif
227
228#ifdef XRT_BUILD_DRIVER_ARDUINO
229 // Before OpenHMD
230 arduino_create_auto_prober,
231#endif
232
233#ifdef XRT_BUILD_DRIVER_DAYDREAM
234 // Before OpenHMD
235 daydream_create_auto_prober,
236#endif
237
238#ifdef XRT_BUILD_DRIVER_OHMD
239 // OpenHMD almost as the end as we want to override it with native drivers.
240 oh_create_auto_prober,
241#endif
242
243#ifdef XRT_BUILD_DRIVER_ANDROID
244 android_create_auto_prober,
245#endif
246
247#ifdef XRT_BUILD_DRIVER_ILLIXR
248 illixr_create_auto_prober,
249#endif
250
251#ifdef XRT_BUILD_DRIVER_REALSENSE
252 rs_create_auto_prober,
253#endif
254
255#ifdef XRT_BUILD_DRIVER_EUROC
256 euroc_create_auto_prober,
257#endif
258
259#ifdef XRT_BUILD_DRIVER_SIMULATED
260 // Simulated headset driver last.
261 simulated_create_auto_prober,
262#endif
263
264 NULL, // Terminate
265};
266
267struct xrt_prober_entry_lists target_lists = {
268 target_builder_list,
269 target_entry_lists,
270 target_auto_list,
271 NULL,
272};