mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
d/vive: Use shared bindings
This commit is contained in:
parent
56b77248c9
commit
456f9c7f09
|
@ -30,6 +30,7 @@
|
|||
#include "util/u_trace_marker.h"
|
||||
|
||||
#include "vive/vive_config.h"
|
||||
#include "vive/vive_bindings.h"
|
||||
|
||||
#include "vive.h"
|
||||
#include "vive_protocol.h"
|
||||
|
@ -990,54 +991,13 @@ vive_controller_run_thread(void *ptr)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Bindings
|
||||
* 'Exported' function(s).
|
||||
*
|
||||
*/
|
||||
|
||||
static struct xrt_binding_input_pair simple_inputs_index[4] = {
|
||||
{XRT_INPUT_SIMPLE_SELECT_CLICK, XRT_INPUT_INDEX_TRIGGER_VALUE},
|
||||
{XRT_INPUT_SIMPLE_MENU_CLICK, XRT_INPUT_INDEX_B_CLICK},
|
||||
{XRT_INPUT_SIMPLE_GRIP_POSE, XRT_INPUT_INDEX_GRIP_POSE},
|
||||
{XRT_INPUT_SIMPLE_AIM_POSE, XRT_INPUT_INDEX_AIM_POSE},
|
||||
};
|
||||
|
||||
static struct xrt_binding_output_pair simple_outputs_index[1] = {
|
||||
{XRT_OUTPUT_NAME_SIMPLE_VIBRATION, XRT_OUTPUT_NAME_INDEX_HAPTIC},
|
||||
};
|
||||
|
||||
static struct xrt_binding_input_pair simple_inputs_vive[4] = {
|
||||
{XRT_INPUT_SIMPLE_SELECT_CLICK, XRT_INPUT_VIVE_TRIGGER_VALUE},
|
||||
{XRT_INPUT_SIMPLE_MENU_CLICK, XRT_INPUT_VIVE_MENU_CLICK},
|
||||
{XRT_INPUT_SIMPLE_GRIP_POSE, XRT_INPUT_VIVE_GRIP_POSE},
|
||||
{XRT_INPUT_SIMPLE_AIM_POSE, XRT_INPUT_VIVE_AIM_POSE},
|
||||
};
|
||||
|
||||
static struct xrt_binding_output_pair simple_outputs_vive[1] = {
|
||||
{XRT_OUTPUT_NAME_SIMPLE_VIBRATION, XRT_OUTPUT_NAME_VIVE_HAPTIC},
|
||||
};
|
||||
|
||||
static struct xrt_binding_profile binding_profiles_index[1] = {
|
||||
{
|
||||
.name = XRT_DEVICE_SIMPLE_CONTROLLER,
|
||||
.inputs = simple_inputs_index,
|
||||
.input_count = ARRAY_SIZE(simple_inputs_index),
|
||||
.outputs = simple_outputs_index,
|
||||
.output_count = ARRAY_SIZE(simple_outputs_index),
|
||||
},
|
||||
};
|
||||
|
||||
static struct xrt_binding_profile binding_profiles_vive[1] = {
|
||||
{
|
||||
.name = XRT_DEVICE_SIMPLE_CONTROLLER,
|
||||
.inputs = simple_inputs_vive,
|
||||
.input_count = ARRAY_SIZE(simple_inputs_vive),
|
||||
.outputs = simple_outputs_vive,
|
||||
.output_count = ARRAY_SIZE(simple_outputs_vive),
|
||||
},
|
||||
};
|
||||
|
||||
#define SET_WAND_INPUT(NAME, NAME2) \
|
||||
do { \
|
||||
(d->base.inputs[VIVE_CONTROLLER_INDEX_##NAME].name = XRT_INPUT_VIVE_##NAME2); \
|
||||
|
@ -1131,8 +1091,8 @@ vive_controller_create(struct os_hid_device *controller_hid, enum watchman_gen w
|
|||
|
||||
d->base.update_inputs = vive_controller_device_update_wand_inputs;
|
||||
|
||||
d->base.binding_profiles = binding_profiles_vive;
|
||||
d->base.binding_profile_count = ARRAY_SIZE(binding_profiles_vive);
|
||||
d->base.binding_profiles = vive_binding_profiles_wand;
|
||||
d->base.binding_profile_count = vive_binding_profiles_wand_count;
|
||||
|
||||
d->base.device_type = XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER;
|
||||
} else if (d->config.variant == CONTROLLER_INDEX_LEFT || d->config.variant == CONTROLLER_INDEX_RIGHT) {
|
||||
|
@ -1170,8 +1130,8 @@ vive_controller_create(struct os_hid_device *controller_hid, enum watchman_gen w
|
|||
|
||||
u_hand_joints_init_default_set(&d->hand_tracking, hand, XRT_HAND_TRACKING_MODEL_FINGERL_CURL, 1.0);
|
||||
|
||||
d->base.binding_profiles = binding_profiles_index;
|
||||
d->base.binding_profile_count = ARRAY_SIZE(binding_profiles_index);
|
||||
d->base.binding_profiles = vive_binding_profiles_index;
|
||||
d->base.binding_profile_count = vive_binding_profiles_index_count;
|
||||
|
||||
if (d->config.variant == CONTROLLER_INDEX_LEFT) {
|
||||
d->base.device_type = XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER;
|
||||
|
|
Loading…
Reference in a new issue