Monado OpenXR Runtime
oxr_binding_data.h
Go to the documentation of this file.
1 // Copyright 2018-2019, Collabora, Ltd.
2 // SPDX-License-Identifier: BSL-1.0
3 /*!
4  * @file
5  * @brief Holds shipped binding data.
6  * @author Jakob Bornecrantz <jakob@collabora.com>
7  * @ingroup oxr_main
8  */
9 
10 // #include "xrt/xrt_compiler.h"
11 
12 #include "oxr_objects.h"
13 
14 
16 {
17  enum oxr_sub_action_path sub_path;
18  const char *paths[8];
19  enum xrt_input_name inputs[8];
20  enum xrt_output_name outputs[8];
21 };
22 
24 {
25  const char *path;
26 
27 
28 
29  struct binding_template *bindings;
30  size_t num_bindings;
31 };
32 
33 /*
34  *
35  * Shipped bindings.
36  *
37  */
38 
39 /*
40  *
41  *
42  *
43  * KHR Simple Controller
44  *
45  *
46  *
47  */
48 
49 static struct binding_template khr_simple_controller_bindings[10] = {
50  {
51  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
52  .paths =
53  {
54  "/user/hand/left/input/select/click",
55  "/user/hand/left/input/select",
56  NULL,
57  },
58  .inputs =
59  {
60  XRT_INPUT_PSMV_TRIGGER_VALUE,
61  XRT_INPUT_HYDRA_TRIGGER_VALUE,
62  XRT_INPUT_DAYDREAM_TOUCHPAD_CLICK,
63  (enum xrt_input_name)0,
64  },
65  },
66  {
67  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
68  .paths =
69  {
70  "/user/hand/left/input/menu/click",
71  "/user/hand/left/input/menu",
72  NULL,
73  },
74  .inputs =
75  {
76  XRT_INPUT_PSMV_MOVE_CLICK,
77  XRT_INPUT_HYDRA_MIDDLE_CLICK,
78  XRT_INPUT_DAYDREAM_BAR_CLICK,
79  (enum xrt_input_name)0,
80  },
81  },
82  {
83  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
84  .paths =
85  {
86  "/user/hand/left/input/grip/pose",
87  "/user/hand/left/input/grip",
88  NULL,
89  },
90  .inputs =
91  {
92  XRT_INPUT_PSMV_BODY_CENTER_POSE,
93  XRT_INPUT_HYDRA_POSE,
94  XRT_INPUT_DAYDREAM_POSE,
95  (enum xrt_input_name)0,
96  },
97  },
98  {
99  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
100  .paths =
101  {
102  "/user/hand/left/input/aim/pose",
103  "/user/hand/left/input/aim",
104  NULL,
105  },
106  .inputs =
107  {
108  XRT_INPUT_PSMV_BALL_TIP_POSE,
109  XRT_INPUT_HYDRA_POSE,
110  XRT_INPUT_DAYDREAM_POSE,
111  (enum xrt_input_name)0,
112  },
113  },
114  {
115  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
116  .paths =
117  {
118  "/user/hand/left/output/haptic",
119  NULL,
120  },
121  .outputs =
122  {
123  XRT_OUTPUT_NAME_PSMV_RUMBLE_VIBRATION,
124  (enum xrt_output_name)0,
125  },
126  },
127  {
128  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
129  .paths =
130  {
131  "/user/hand/right/input/select/click",
132  "/user/hand/right/input/select",
133  NULL,
134  },
135  .inputs =
136  {
137  XRT_INPUT_PSMV_TRIGGER_VALUE,
138  XRT_INPUT_HYDRA_TRIGGER_VALUE,
139  XRT_INPUT_DAYDREAM_TOUCHPAD_CLICK,
140  (enum xrt_input_name)0,
141  },
142  },
143  {
144  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
145  .paths =
146  {
147  "/user/hand/right/input/menu/click",
148  "/user/hand/right/input/menu",
149  NULL,
150  },
151  .inputs =
152  {
153  XRT_INPUT_PSMV_MOVE_CLICK,
154  XRT_INPUT_HYDRA_MIDDLE_CLICK,
155  XRT_INPUT_DAYDREAM_BAR_CLICK,
156  (enum xrt_input_name)0,
157  },
158  },
159  {
160  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
161  .paths =
162  {
163  "/user/hand/right/input/grip/pose",
164  "/user/hand/right/input/grip",
165  NULL,
166  },
167  .inputs =
168  {
169  XRT_INPUT_PSMV_BODY_CENTER_POSE,
170  XRT_INPUT_HYDRA_POSE,
171  XRT_INPUT_DAYDREAM_POSE,
172  (enum xrt_input_name)0,
173  },
174  },
175  {
176  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
177  .paths =
178  {
179  "/user/hand/right/input/aim/pose",
180  "/user/hand/right/input/aim",
181  NULL,
182  },
183  .inputs =
184  {
185  XRT_INPUT_PSMV_BALL_TIP_POSE,
186  XRT_INPUT_HYDRA_POSE,
187  XRT_INPUT_DAYDREAM_POSE,
188  (enum xrt_input_name)0,
189  },
190  },
191  {
192  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
193  .paths =
194  {
195  "/user/hand/right/output/haptic",
196  NULL,
197  },
198  .outputs =
199  {
200  XRT_OUTPUT_NAME_PSMV_RUMBLE_VIBRATION,
201  (enum xrt_output_name)0,
202  },
203  },
204 };
205 
206 
207 /*
208  *
209  *
210  *
211  * Google Daydream Controller
212  *
213  *
214  *
215  */
216 
217 static struct binding_template google_daydream_controller_bindings[12] = {
218  {
219  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
220  .paths =
221  {
222  "/user/hand/left/input/select/click",
223  "/user/hand/left/input/select",
224  NULL,
225  },
226  .inputs =
227  {
228 #if 0
229  XRT_INPUT_PSMV_TRIGGER_VALUE,
230  XRT_INPUT_HYDRA_TRIGGER_VALUE,
231 #endif
232  (enum xrt_input_name)0,
233  },
234  },
235  {
236  //! @todo Flag that this is a trackpad
237  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
238  .paths =
239  {
240  "/user/hand/left/input/trackpad",
241  "/user/hand/left/input/trackpad/x",
242  "/user/hand/left/input/trackpad/y",
243  NULL,
244  },
245  .inputs =
246  {
247  (enum xrt_input_name)0,
248  },
249  },
250  {
251  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
252  .paths =
253  {
254  "/user/hand/left/input/trackpad/click",
255  "/user/hand/left/input/trackpad",
256  NULL,
257  },
258  .inputs =
259  {
260  (enum xrt_input_name)0,
261  },
262  },
263  {
264  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
265  .paths =
266  {
267  "/user/hand/left/input/trackpad/touch",
268  NULL,
269  },
270  .inputs =
271  {
272  (enum xrt_input_name)0,
273  },
274  },
275  {
276  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
277  .paths =
278  {
279  "/user/hand/left/input/grip/pose",
280  "/user/hand/left/input/grip",
281  NULL,
282  },
283  .inputs =
284  {
285 #if 0
286  XRT_INPUT_PSMV_BODY_CENTER_POSE,
287  XRT_INPUT_HYDRA_POSE,
288 #endif
289  (enum xrt_input_name)0,
290  },
291  },
292  {
293  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
294  .paths =
295  {
296  "/user/hand/left/input/aim/pose",
297  "/user/hand/left/input/aim",
298  NULL,
299  },
300  .inputs =
301  {
302 #if 0
303  XRT_INPUT_PSMV_BALL_TIP_POSE,
304  XRT_INPUT_HYDRA_POSE,
305 #endif
306  (enum xrt_input_name)0,
307  },
308  },
309  {
310  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
311  .paths =
312  {
313  "/user/hand/right/input/select/click",
314  "/user/hand/right/input/select",
315  NULL,
316  },
317  .inputs =
318  {
319 #if 0
320  XRT_INPUT_PSMV_TRIGGER_VALUE,
321  XRT_INPUT_HYDRA_TRIGGER_VALUE,
322 #endif
323  (enum xrt_input_name)0,
324  },
325  },
326  {
327  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
328  //! @todo Flag that this is a trackpad
329  .paths =
330  {
331  "/user/hand/right/input/trackpad",
332  "/user/hand/right/input/trackpad/x",
333  "/user/hand/right/input/trackpad/y",
334  NULL,
335  },
336  .inputs =
337  {
338  (enum xrt_input_name)0,
339  },
340  },
341  {
342  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
343  .paths =
344  {
345  "/user/hand/right/input/trackpad/click",
346  "/user/hand/right/input/trackpad",
347  NULL,
348  },
349  .inputs =
350  {
351  (enum xrt_input_name)0,
352  },
353  },
354  {
355  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
356  .paths =
357  {
358  "/user/hand/right/input/trackpad/touch",
359  NULL,
360  },
361  .inputs =
362  {
363  (enum xrt_input_name)0,
364  },
365  },
366  {
367  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
368  .paths =
369  {
370  "/user/hand/right/input/grip/pose",
371  "/user/hand/right/input/grip",
372  NULL,
373  },
374  .inputs =
375  {
376 #if 0
377  XRT_INPUT_PSMV_BODY_CENTER_POSE,
378  XRT_INPUT_HYDRA_POSE,
379 #endif
380  (enum xrt_input_name)0,
381  },
382  },
383  {
384  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
385  .paths =
386  {
387  "/user/hand/right/input/aim/pose",
388  "/user/hand/right/input/aim",
389  NULL,
390  },
391  .inputs =
392  {
393 #if 0
394  XRT_INPUT_PSMV_BALL_TIP_POSE,
395  XRT_INPUT_HYDRA_POSE,
396 #endif
397  (enum xrt_input_name)0,
398  },
399  },
400 };
401 
402 
403 /*
404  *
405  *
406  *
407  * Monado ball on a stick controller
408  *
409  *
410  *
411  */
412 
413 static struct binding_template mnd_ball_on_stick_controller_bindings[26] = {
414  {
415  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
416  .paths =
417  {
418  "/user/hand/left/input/system/click",
419  "/user/hand/left/input/system",
420  NULL,
421  },
422  .inputs =
423  {
424  XRT_INPUT_PSMV_PS_CLICK,
425  (enum xrt_input_name)0,
426  },
427  },
428  {
429  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
430  .paths =
431  {
432  "/user/hand/left/input/menu/click",
433  "/user/hand/left/input/menu",
434  NULL,
435  },
436  .inputs =
437  {
438  XRT_INPUT_PSMV_MOVE_CLICK,
439  (enum xrt_input_name)0,
440  },
441  },
442  {
443  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
444  .paths =
445  {
446  "/user/hand/left/input/start/click",
447  "/user/hand/left/input/start",
448  NULL,
449  },
450  .inputs =
451  {
452  XRT_INPUT_PSMV_START_CLICK,
453  (enum xrt_input_name)0,
454  },
455  },
456  {
457  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
458  .paths =
459  {
460  "/user/hand/left/input/select/click",
461  "/user/hand/left/input/select",
462  NULL,
463  },
464  .inputs =
465  {
466  XRT_INPUT_PSMV_SELECT_CLICK,
467  (enum xrt_input_name)0,
468  },
469  },
470  {
471  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
472  .paths =
473  {
474  "/user/hand/left/input/square_mnd/click",
475  "/user/hand/left/input/square_mnd",
476  NULL,
477  },
478  .inputs =
479  {
480  XRT_INPUT_PSMV_SQUARE_CLICK,
481  (enum xrt_input_name)0,
482  },
483  },
484  {
485  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
486  .paths =
487  {
488  "/user/hand/left/input/cross_mnd/click",
489  "/user/hand/left/input/cross_mnd",
490  NULL,
491  },
492  .inputs =
493  {
494  XRT_INPUT_PSMV_CROSS_CLICK,
495  (enum xrt_input_name)0,
496  },
497  },
498  {
499  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
500  .paths =
501  {
502  "/user/hand/left/input/circle_mnd/click",
503  "/user/hand/left/input/circle_mnd",
504  NULL,
505  },
506  .inputs =
507  {
508  XRT_INPUT_PSMV_CIRCLE_CLICK,
509  (enum xrt_input_name)0,
510  },
511  },
512  {
513  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
514  .paths =
515  {
516  "/user/hand/left/input/triangle_mnd/click",
517  "/user/hand/left/input/triangle_mnd",
518  NULL,
519  },
520  .inputs =
521  {
522  XRT_INPUT_PSMV_TRIANGLE_CLICK,
523  (enum xrt_input_name)0,
524  },
525  },
526  {
527  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
528  .paths =
529  {
530  "/user/hand/left/input/trigger/value",
531  "/user/hand/left/input/trigger",
532  NULL,
533  },
534  .inputs =
535  {
536  XRT_INPUT_PSMV_TRIGGER_VALUE,
537  (enum xrt_input_name)0,
538  },
539  },
540  {
541  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
542  .paths =
543  {
544  "/user/hand/left/input/grip/pose",
545  "/user/hand/left/input/grip",
546  NULL,
547  },
548  .inputs =
549  {
550  XRT_INPUT_PSMV_BODY_CENTER_POSE,
551  (enum xrt_input_name)0,
552  },
553  },
554  {
555  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
556  .paths =
557  {
558  "/user/hand/left/input/ball_mnd/pose",
559  "/user/hand/left/input/ball_mnd",
560  NULL,
561  },
562  .inputs =
563  {
564  XRT_INPUT_PSMV_BALL_CENTER_POSE,
565  (enum xrt_input_name)0,
566  },
567  },
568  {
569  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
570  .paths =
571  {
572  "/user/hand/left/input/aim/pose",
573  "/user/hand/left/input/aim",
574  NULL,
575  },
576  .inputs =
577  {
578  XRT_INPUT_PSMV_BALL_TIP_POSE,
579  (enum xrt_input_name)0,
580  },
581  },
582  {
583  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
584  .paths =
585  {
586  "/user/hand/left/output/haptic",
587  NULL,
588  },
589  .outputs =
590  {
591  XRT_OUTPUT_NAME_PSMV_RUMBLE_VIBRATION,
592  (enum xrt_output_name)0,
593  },
594  },
595  {
596  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
597  .paths =
598  {
599  "/user/hand/right/input/system/click",
600  "/user/hand/right/input/system",
601  NULL,
602  },
603  .inputs =
604  {
605  XRT_INPUT_PSMV_PS_CLICK,
606  (enum xrt_input_name)0,
607  },
608  },
609  {
610  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
611  .paths =
612  {
613  "/user/hand/right/input/menu/click",
614  "/user/hand/right/input/menu",
615  NULL,
616  },
617  .inputs =
618  {
619  XRT_INPUT_PSMV_MOVE_CLICK,
620  (enum xrt_input_name)0,
621  },
622  },
623  {
624  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
625  .paths =
626  {
627  "/user/hand/right/input/start/click",
628  "/user/hand/right/input/start",
629  NULL,
630  },
631  .inputs =
632  {
633  XRT_INPUT_PSMV_START_CLICK,
634  (enum xrt_input_name)0,
635  },
636  },
637  {
638  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
639  .paths =
640  {
641  "/user/hand/right/input/select/click",
642  "/user/hand/right/input/select",
643  NULL,
644  },
645  .inputs =
646  {
647  XRT_INPUT_PSMV_SELECT_CLICK,
648  (enum xrt_input_name)0,
649  },
650  },
651  {
652  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
653  .paths =
654  {
655  "/user/hand/right/input/square_mnd/click",
656  "/user/hand/right/input/square_mnd",
657  NULL,
658  },
659  .inputs =
660  {
661  XRT_INPUT_PSMV_SQUARE_CLICK,
662  (enum xrt_input_name)0,
663  },
664  },
665  {
666  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
667  .paths =
668  {
669  "/user/hand/right/input/cross_mnd/click",
670  "/user/hand/right/input/cross_mnd",
671  NULL,
672  },
673  .inputs =
674  {
675  XRT_INPUT_PSMV_CROSS_CLICK,
676  (enum xrt_input_name)0,
677  },
678  },
679  {
680  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
681  .paths =
682  {
683  "/user/hand/right/input/circle_mnd/click",
684  "/user/hand/right/input/circle_mnd",
685  NULL,
686  },
687  .inputs =
688  {
689  XRT_INPUT_PSMV_CIRCLE_CLICK,
690  (enum xrt_input_name)0,
691  },
692  },
693  {
694  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
695  .paths =
696  {
697  "/user/hand/right/input/triangle_mnd/click",
698  "/user/hand/right/input/triangle_mnd",
699  NULL,
700  },
701  .inputs =
702  {
703  XRT_INPUT_PSMV_TRIANGLE_CLICK,
704  (enum xrt_input_name)0,
705  },
706  },
707  {
708  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
709  .paths =
710  {
711  "/user/hand/right/input/trigger/value",
712  "/user/hand/right/input/trigger",
713  NULL,
714  },
715  .inputs =
716  {
717  XRT_INPUT_PSMV_TRIGGER_VALUE,
718  (enum xrt_input_name)0,
719  },
720  },
721  {
722  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
723  .paths =
724  {
725  "/user/hand/right/input/grip/pose",
726  "/user/hand/right/input/grip",
727  NULL,
728  },
729  .inputs =
730  {
731  XRT_INPUT_PSMV_BODY_CENTER_POSE,
732  (enum xrt_input_name)0,
733  },
734  },
735  {
736  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
737  .paths =
738  {
739  "/user/hand/right/input/ball_mnd/pose",
740  "/user/hand/right/input/ball_mnd",
741  NULL,
742  },
743  .inputs =
744  {
745  XRT_INPUT_PSMV_BALL_CENTER_POSE,
746  (enum xrt_input_name)0,
747  },
748  },
749  {
750  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
751  .paths =
752  {
753  "/user/hand/right/input/aim/pose",
754  "/user/hand/right/input/aim",
755  NULL,
756  },
757  .inputs =
758  {
759  XRT_INPUT_PSMV_BALL_TIP_POSE,
760  (enum xrt_input_name)0,
761  },
762  },
763  {
764  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
765  .paths =
766  {
767  "/user/hand/right/output/haptic",
768  NULL,
769  },
770  .outputs =
771  {
772  XRT_OUTPUT_NAME_PSMV_RUMBLE_VIBRATION,
773  (enum xrt_output_name)0,
774  },
775  },
776 };
777 
778 static struct profile_template profiles[3] = {
779  {
780  .path = "/interaction_profiles/khr/simple_controller",
781  .bindings = khr_simple_controller_bindings,
782  .num_bindings = ARRAY_SIZE(khr_simple_controller_bindings),
783  },
784  {
785  .path = "/interaction_profiles/google/daydream_controller",
786  .bindings = google_daydream_controller_bindings,
787  .num_bindings = ARRAY_SIZE(google_daydream_controller_bindings),
788  },
789  {
790  .path = "/interaction_profiles/mnd/ball_on_stick_controller",
791  .bindings = mnd_ball_on_stick_controller_bindings,
792  .num_bindings = ARRAY_SIZE(mnd_ball_on_stick_controller_bindings),
793  },
794 };
Definition: oxr_binding_data.h:15
Definition: oxr_binding_data.h:23
#define ARRAY_SIZE(a)
Array size helper.
Definition: xrt_compiler.h:24
xrt_output_name
Name of a output with a baked in type.
Definition: xrt_defines.h:494
oxr_sub_action_path
Sub action paths.
Definition: oxr_objects.h:111
Contains the instance struct that a lot of things hang from.
xrt_input_name
Name of a input with a baked in type.
Definition: xrt_defines.h:417