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 {
18  const char *paths[8];
21 };
22 
24 {
25  const char *path;
26 
27 
28 
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  {
52  .paths =
53  {
54  "/user/hand/left/input/select/click",
55  "/user/hand/left/input/select",
56  NULL,
57  },
58  .inputs =
59  {
65  (enum xrt_input_name)0,
66  },
67  },
68  {
69  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
70  .paths =
71  {
72  "/user/hand/left/input/menu/click",
73  "/user/hand/left/input/menu",
74  NULL,
75  },
76  .inputs =
77  {
83  (enum xrt_input_name)0,
84  },
85  },
86  {
87  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
88  .paths =
89  {
90  "/user/hand/left/input/grip/pose",
91  "/user/hand/left/input/grip",
92  NULL,
93  },
94  .inputs =
95  {
101  (enum xrt_input_name)0,
102  },
103  },
104  {
105  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
106  .paths =
107  {
108  "/user/hand/left/input/aim/pose",
109  "/user/hand/left/input/aim",
110  NULL,
111  },
112  .inputs =
113  {
119  (enum xrt_input_name)0,
120  },
121  },
122  {
123  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
124  .paths =
125  {
126  "/user/hand/left/output/haptic",
127  NULL,
128  },
129  .outputs =
130  {
134  (enum xrt_output_name)0,
135  },
136  },
137  {
138  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
139  .paths =
140  {
141  "/user/hand/right/input/select/click",
142  "/user/hand/right/input/select",
143  NULL,
144  },
145  .inputs =
146  {
152  (enum xrt_input_name)0,
153  },
154  },
155  {
156  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
157  .paths =
158  {
159  "/user/hand/right/input/menu/click",
160  "/user/hand/right/input/menu",
161  NULL,
162  },
163  .inputs =
164  {
170  (enum xrt_input_name)0,
171  },
172  },
173  {
174  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
175  .paths =
176  {
177  "/user/hand/right/input/grip/pose",
178  "/user/hand/right/input/grip",
179  NULL,
180  },
181  .inputs =
182  {
188  (enum xrt_input_name)0,
189  },
190  },
191  {
192  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
193  .paths =
194  {
195  "/user/hand/right/input/aim/pose",
196  "/user/hand/right/input/aim",
197  NULL,
198  },
199  .inputs =
200  {
206  (enum xrt_input_name)0,
207  },
208  },
209  {
210  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
211  .paths =
212  {
213  "/user/hand/right/output/haptic",
214  NULL,
215  },
216  .outputs =
217  {
221  (enum xrt_output_name)0,
222  },
223  },
224 };
225 
226 
227 /*
228  *
229  *
230  *
231  * Google Daydream Controller
232  *
233  *
234  *
235  */
236 
237 static struct binding_template google_daydream_controller_bindings[12] = {
238  {
240  .paths =
241  {
242  "/user/hand/left/input/select/click",
243  "/user/hand/left/input/select",
244  NULL,
245  },
246  .inputs =
247  {
248 #if 0
251 #endif
252  (enum xrt_input_name)0,
253  },
254  },
255  {
256  //! @todo Flag that this is a trackpad
257  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
258  .paths =
259  {
260  "/user/hand/left/input/trackpad",
261  "/user/hand/left/input/trackpad/x",
262  "/user/hand/left/input/trackpad/y",
263  NULL,
264  },
265  .inputs =
266  {
267  (enum xrt_input_name)0,
268  },
269  },
270  {
271  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
272  .paths =
273  {
274  "/user/hand/left/input/trackpad/click",
275  "/user/hand/left/input/trackpad",
276  NULL,
277  },
278  .inputs =
279  {
280  (enum xrt_input_name)0,
281  },
282  },
283  {
284  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
285  .paths =
286  {
287  "/user/hand/left/input/trackpad/touch",
288  NULL,
289  },
290  .inputs =
291  {
292  (enum xrt_input_name)0,
293  },
294  },
295  {
296  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
297  .paths =
298  {
299  "/user/hand/left/input/grip/pose",
300  "/user/hand/left/input/grip",
301  NULL,
302  },
303  .inputs =
304  {
305 #if 0
308 #endif
309  (enum xrt_input_name)0,
310  },
311  },
312  {
313  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
314  .paths =
315  {
316  "/user/hand/left/input/aim/pose",
317  "/user/hand/left/input/aim",
318  NULL,
319  },
320  .inputs =
321  {
322 #if 0
325 #endif
326  (enum xrt_input_name)0,
327  },
328  },
329  {
330  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
331  .paths =
332  {
333  "/user/hand/right/input/select/click",
334  "/user/hand/right/input/select",
335  NULL,
336  },
337  .inputs =
338  {
339 #if 0
342 #endif
343  (enum xrt_input_name)0,
344  },
345  },
346  {
347  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
348  //! @todo Flag that this is a trackpad
349  .paths =
350  {
351  "/user/hand/right/input/trackpad",
352  "/user/hand/right/input/trackpad/x",
353  "/user/hand/right/input/trackpad/y",
354  NULL,
355  },
356  .inputs =
357  {
358  (enum xrt_input_name)0,
359  },
360  },
361  {
362  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
363  .paths =
364  {
365  "/user/hand/right/input/trackpad/click",
366  "/user/hand/right/input/trackpad",
367  NULL,
368  },
369  .inputs =
370  {
371  (enum xrt_input_name)0,
372  },
373  },
374  {
375  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
376  .paths =
377  {
378  "/user/hand/right/input/trackpad/touch",
379  NULL,
380  },
381  .inputs =
382  {
383  (enum xrt_input_name)0,
384  },
385  },
386  {
387  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
388  .paths =
389  {
390  "/user/hand/right/input/grip/pose",
391  "/user/hand/right/input/grip",
392  NULL,
393  },
394  .inputs =
395  {
396 #if 0
399 #endif
400  (enum xrt_input_name)0,
401  },
402  },
403  {
404  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
405  .paths =
406  {
407  "/user/hand/right/input/aim/pose",
408  "/user/hand/right/input/aim",
409  NULL,
410  },
411  .inputs =
412  {
413 #if 0
416 #endif
417  (enum xrt_input_name)0,
418  },
419  },
420 };
421 
422 
423 /*
424  *
425  *
426  *
427  * Monado ball on a stick controller
428  *
429  *
430  *
431  */
432 
433 static struct binding_template mnd_ball_on_stick_controller_bindings[26] = {
434  {
436  .paths =
437  {
438  "/user/hand/left/input/system/click",
439  "/user/hand/left/input/system",
440  NULL,
441  },
442  .inputs =
443  {
445  (enum xrt_input_name)0,
446  },
447  },
448  {
449  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
450  .paths =
451  {
452  "/user/hand/left/input/menu/click",
453  "/user/hand/left/input/menu",
454  NULL,
455  },
456  .inputs =
457  {
459  (enum xrt_input_name)0,
460  },
461  },
462  {
463  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
464  .paths =
465  {
466  "/user/hand/left/input/start/click",
467  "/user/hand/left/input/start",
468  NULL,
469  },
470  .inputs =
471  {
473  (enum xrt_input_name)0,
474  },
475  },
476  {
477  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
478  .paths =
479  {
480  "/user/hand/left/input/select/click",
481  "/user/hand/left/input/select",
482  NULL,
483  },
484  .inputs =
485  {
487  (enum xrt_input_name)0,
488  },
489  },
490  {
491  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
492  .paths =
493  {
494  "/user/hand/left/input/square_mnd/click",
495  "/user/hand/left/input/square_mnd",
496  NULL,
497  },
498  .inputs =
499  {
501  (enum xrt_input_name)0,
502  },
503  },
504  {
505  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
506  .paths =
507  {
508  "/user/hand/left/input/cross_mnd/click",
509  "/user/hand/left/input/cross_mnd",
510  NULL,
511  },
512  .inputs =
513  {
515  (enum xrt_input_name)0,
516  },
517  },
518  {
519  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
520  .paths =
521  {
522  "/user/hand/left/input/circle_mnd/click",
523  "/user/hand/left/input/circle_mnd",
524  NULL,
525  },
526  .inputs =
527  {
529  (enum xrt_input_name)0,
530  },
531  },
532  {
533  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
534  .paths =
535  {
536  "/user/hand/left/input/triangle_mnd/click",
537  "/user/hand/left/input/triangle_mnd",
538  NULL,
539  },
540  .inputs =
541  {
543  (enum xrt_input_name)0,
544  },
545  },
546  {
547  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
548  .paths =
549  {
550  "/user/hand/left/input/trigger/value",
551  "/user/hand/left/input/trigger",
552  NULL,
553  },
554  .inputs =
555  {
557  (enum xrt_input_name)0,
558  },
559  },
560  {
561  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
562  .paths =
563  {
564  "/user/hand/left/input/grip/pose",
565  "/user/hand/left/input/grip",
566  NULL,
567  },
568  .inputs =
569  {
571  (enum xrt_input_name)0,
572  },
573  },
574  {
575  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
576  .paths =
577  {
578  "/user/hand/left/input/ball_mnd/pose",
579  "/user/hand/left/input/ball_mnd",
580  NULL,
581  },
582  .inputs =
583  {
585  (enum xrt_input_name)0,
586  },
587  },
588  {
589  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
590  .paths =
591  {
592  "/user/hand/left/input/aim/pose",
593  "/user/hand/left/input/aim",
594  NULL,
595  },
596  .inputs =
597  {
599  (enum xrt_input_name)0,
600  },
601  },
602  {
603  .sub_path = OXR_SUB_ACTION_PATH_LEFT,
604  .paths =
605  {
606  "/user/hand/left/output/haptic",
607  NULL,
608  },
609  .outputs =
610  {
612  (enum xrt_output_name)0,
613  },
614  },
615  {
616  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
617  .paths =
618  {
619  "/user/hand/right/input/system/click",
620  "/user/hand/right/input/system",
621  NULL,
622  },
623  .inputs =
624  {
626  (enum xrt_input_name)0,
627  },
628  },
629  {
630  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
631  .paths =
632  {
633  "/user/hand/right/input/menu/click",
634  "/user/hand/right/input/menu",
635  NULL,
636  },
637  .inputs =
638  {
640  (enum xrt_input_name)0,
641  },
642  },
643  {
644  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
645  .paths =
646  {
647  "/user/hand/right/input/start/click",
648  "/user/hand/right/input/start",
649  NULL,
650  },
651  .inputs =
652  {
654  (enum xrt_input_name)0,
655  },
656  },
657  {
658  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
659  .paths =
660  {
661  "/user/hand/right/input/select/click",
662  "/user/hand/right/input/select",
663  NULL,
664  },
665  .inputs =
666  {
668  (enum xrt_input_name)0,
669  },
670  },
671  {
672  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
673  .paths =
674  {
675  "/user/hand/right/input/square_mnd/click",
676  "/user/hand/right/input/square_mnd",
677  NULL,
678  },
679  .inputs =
680  {
682  (enum xrt_input_name)0,
683  },
684  },
685  {
686  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
687  .paths =
688  {
689  "/user/hand/right/input/cross_mnd/click",
690  "/user/hand/right/input/cross_mnd",
691  NULL,
692  },
693  .inputs =
694  {
696  (enum xrt_input_name)0,
697  },
698  },
699  {
700  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
701  .paths =
702  {
703  "/user/hand/right/input/circle_mnd/click",
704  "/user/hand/right/input/circle_mnd",
705  NULL,
706  },
707  .inputs =
708  {
710  (enum xrt_input_name)0,
711  },
712  },
713  {
714  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
715  .paths =
716  {
717  "/user/hand/right/input/triangle_mnd/click",
718  "/user/hand/right/input/triangle_mnd",
719  NULL,
720  },
721  .inputs =
722  {
724  (enum xrt_input_name)0,
725  },
726  },
727  {
728  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
729  .paths =
730  {
731  "/user/hand/right/input/trigger/value",
732  "/user/hand/right/input/trigger",
733  NULL,
734  },
735  .inputs =
736  {
738  (enum xrt_input_name)0,
739  },
740  },
741  {
742  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
743  .paths =
744  {
745  "/user/hand/right/input/grip/pose",
746  "/user/hand/right/input/grip",
747  NULL,
748  },
749  .inputs =
750  {
752  (enum xrt_input_name)0,
753  },
754  },
755  {
756  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
757  .paths =
758  {
759  "/user/hand/right/input/ball_mnd/pose",
760  "/user/hand/right/input/ball_mnd",
761  NULL,
762  },
763  .inputs =
764  {
766  (enum xrt_input_name)0,
767  },
768  },
769  {
770  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
771  .paths =
772  {
773  "/user/hand/right/input/aim/pose",
774  "/user/hand/right/input/aim",
775  NULL,
776  },
777  .inputs =
778  {
780  (enum xrt_input_name)0,
781  },
782  },
783  {
784  .sub_path = OXR_SUB_ACTION_PATH_RIGHT,
785  .paths =
786  {
787  "/user/hand/right/output/haptic",
788  NULL,
789  },
790  .outputs =
791  {
793  (enum xrt_output_name)0,
794  },
795  },
796 };
797 
798 
799 #define MAKE_INPUT(COMPONENT, SUFFIX, INPUT) \
800  { \
801  .sub_path = OXR_SUB_ACTION_PATH_LEFT, \
802  .paths = \
803  { \
804  "/user/hand/left/input/" #COMPONENT "/" #SUFFIX, \
805  "/user/hand/left/input/" #COMPONENT, \
806  NULL, \
807  }, \
808  .inputs = \
809  { \
810  INPUT, \
811  (enum xrt_input_name)0, \
812  }, \
813  }, \
814  { \
815  .sub_path = OXR_SUB_ACTION_PATH_RIGHT, \
816  .paths = \
817  { \
818  "/user/hand/right/input/" #COMPONENT "/" #SUFFIX, \
819  "/user/hand/right/input/" #COMPONENT, \
820  NULL, \
821  }, \
822  .inputs = \
823  { \
824  INPUT, \
825  (enum xrt_input_name)0, \
826  }, \
827  },
828 
829 #define MAKE_OUTPUT(COMPONENT, SUFFIX, OUTPUT) \
830  { \
831  .sub_path = OXR_SUB_ACTION_PATH_LEFT, \
832  .paths = \
833  { \
834  "/user/hand/left/output/" #COMPONENT "/" #SUFFIX, \
835  "/user/hand/left/output/" #COMPONENT, \
836  NULL, \
837  }, \
838  .outputs = \
839  { \
840  OUTPUT, \
841  (enum xrt_output_name)0, \
842  }, \
843  }, \
844  { \
845  .sub_path = OXR_SUB_ACTION_PATH_RIGHT, \
846  .paths = \
847  { \
848  "/user/hand/right/output/" #COMPONENT "/" #SUFFIX, \
849  "/user/hand/right/output/" #COMPONENT, \
850  NULL, \
851  }, \
852  .outputs = \
853  { \
854  OUTPUT, \
855  (enum xrt_output_name)0, \
856  }, \
857  },
858 
859 static struct binding_template valve_index_controller_bindings[44] = {
860  // clang-format off
874  MAKE_INPUT(thumbstick, click, XRT_INPUT_INDEX_THUMBSTICK_CLICK)
882 
884  // clang-format on
885 };
886 
887 static struct binding_template htc_vive_controller_bindings[24] = {
888  // clang-format off
896  MAKE_INPUT(trackpad, click, XRT_INPUT_VIVE_TRACKPAD_CLICK)
900 
902  // clang-format on
903 };
904 
905 static struct profile_template profiles[5] = {
906  {
907  .path = "/interaction_profiles/khr/simple_controller",
908  .bindings = khr_simple_controller_bindings,
909  .num_bindings = ARRAY_SIZE(khr_simple_controller_bindings),
910  },
911  {
912  .path = "/interaction_profiles/google/daydream_controller",
913  .bindings = google_daydream_controller_bindings,
914  .num_bindings = ARRAY_SIZE(google_daydream_controller_bindings),
915  },
916  {
917  .path = "/interaction_profiles/mnd/ball_on_stick_controller",
918  .bindings = mnd_ball_on_stick_controller_bindings,
919  .num_bindings = ARRAY_SIZE(mnd_ball_on_stick_controller_bindings),
920  },
921  {
922  .path = "/interaction_profiles/valve/index_controller",
923  .bindings = valve_index_controller_bindings,
924  .num_bindings = ARRAY_SIZE(valve_index_controller_bindings),
925  },
926  {
927  .path = "/interaction_profiles/htc/vive_controller",
928  .bindings = htc_vive_controller_bindings,
929  .num_bindings = ARRAY_SIZE(htc_vive_controller_bindings),
930  },
931 };
Definition: xrt_defines.h:449
Definition: xrt_defines.h:465
#define MAKE_OUTPUT(COMPONENT, SUFFIX, OUTPUT)
Definition: oxr_binding_data.h:829
Definition: xrt_defines.h:474
Definition: xrt_defines.h:430
Definition: xrt_defines.h:484
Definition: xrt_defines.h:459
Definition: xrt_defines.h:470
Definition: xrt_defines.h:434
Definition: xrt_defines.h:485
enum xrt_input_name inputs[8]
Definition: oxr_binding_data.h:19
Definition: xrt_defines.h:488
Definition: xrt_defines.h:489
Definition: oxr_binding_data.h:15
Definition: xrt_defines.h:535
Definition: xrt_defines.h:473
size_t num_bindings
Definition: oxr_binding_data.h:30
Definition: oxr_binding_data.h:23
Definition: xrt_defines.h:466
#define ARRAY_SIZE(a)
Array size helper.
Definition: xrt_compiler.h:24
Definition: xrt_defines.h:481
Definition: xrt_defines.h:491
Definition: xrt_defines.h:451
Definition: xrt_defines.h:477
Definition: xrt_defines.h:431
uint16_t touch[2]
Definition: vive_protocol.h:221
Definition: xrt_defines.h:428
Definition: xrt_defines.h:436
Definition: xrt_defines.h:478
Definition: xrt_defines.h:448
xrt_output_name
Name of a output with a baked in type.
Definition: xrt_defines.h:532
Definition: xrt_defines.h:493
Definition: xrt_defines.h:480
#define MAKE_INPUT(COMPONENT, SUFFIX, INPUT)
Definition: oxr_binding_data.h:799
Definition: xrt_defines.h:487
Definition: xrt_defines.h:463
Definition: xrt_defines.h:427
Definition: xrt_defines.h:429
Definition: xrt_defines.h:433
Definition: xrt_defines.h:462
Definition: xrt_defines.h:475
Definition: xrt_defines.h:437
Definition: xrt_defines.h:479
Definition: xrt_defines.h:464
Definition: xrt_defines.h:483
struct binding_template * bindings
Definition: oxr_binding_data.h:29
Definition: xrt_defines.h:444
Definition: oxr_objects.h:117
oxr_sub_action_path
Sub action paths.
Definition: oxr_objects.h:112
Definition: oxr_objects.h:116
Definition: xrt_defines.h:476
enum xrt_output_name outputs[8]
Definition: oxr_binding_data.h:20
Contains the instance struct that a lot of things hang from.
Definition: xrt_defines.h:438
Definition: xrt_defines.h:471
Definition: xrt_defines.h:452
uint16_t trigger
Definition: vive_protocol.h:215
Definition: xrt_defines.h:461
Definition: xrt_defines.h:486
Definition: xrt_defines.h:537
Definition: xrt_defines.h:435
enum oxr_sub_action_path sub_path
Definition: oxr_binding_data.h:17
Definition: xrt_defines.h:467
Definition: xrt_defines.h:490
const char * paths[8]
Definition: oxr_binding_data.h:18
Definition: xrt_defines.h:472
xrt_input_name
Name of a input with a baked in type.
Definition: xrt_defines.h:421
Definition: xrt_defines.h:492
Definition: xrt_defines.h:469
const char * path
Definition: oxr_binding_data.h:25
Definition: xrt_defines.h:536
Definition: xrt_defines.h:432