From 56b77248c9fc63ccde16ab277eb04d4a521a6186 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 6 May 2022 12:46:03 +0100 Subject: [PATCH] a/vive: Add bindings to touch controller --- src/xrt/auxiliary/vive/vive_bindings.c | 35 +++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/xrt/auxiliary/vive/vive_bindings.c b/src/xrt/auxiliary/vive/vive_bindings.c index d560093e0..19481df4c 100644 --- a/src/xrt/auxiliary/vive/vive_bindings.c +++ b/src/xrt/auxiliary/vive/vive_bindings.c @@ -30,8 +30,41 @@ 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 touch_inputs_index[19] = { + {XRT_INPUT_TOUCH_X_CLICK, XRT_INPUT_INDEX_A_CLICK}, + {XRT_INPUT_TOUCH_X_TOUCH, XRT_INPUT_INDEX_A_TOUCH}, + {XRT_INPUT_TOUCH_Y_CLICK, XRT_INPUT_INDEX_B_CLICK}, + {XRT_INPUT_TOUCH_Y_TOUCH, XRT_INPUT_INDEX_B_TOUCH}, + {XRT_INPUT_TOUCH_MENU_CLICK, XRT_INPUT_INDEX_SYSTEM_CLICK}, // Map to menu + {XRT_INPUT_TOUCH_A_CLICK, XRT_INPUT_INDEX_A_CLICK}, + {XRT_INPUT_TOUCH_A_TOUCH, XRT_INPUT_INDEX_A_TOUCH}, + {XRT_INPUT_TOUCH_B_CLICK, XRT_INPUT_INDEX_B_CLICK}, + {XRT_INPUT_TOUCH_B_TOUCH, XRT_INPUT_INDEX_B_TOUCH}, + {XRT_INPUT_TOUCH_SYSTEM_CLICK, XRT_INPUT_INDEX_SYSTEM_CLICK}, + {XRT_INPUT_TOUCH_SQUEEZE_VALUE, XRT_INPUT_INDEX_SQUEEZE_VALUE}, + {XRT_INPUT_TOUCH_TRIGGER_TOUCH, XRT_INPUT_INDEX_TRIGGER_TOUCH}, + {XRT_INPUT_TOUCH_TRIGGER_VALUE, XRT_INPUT_INDEX_TRIGGER_VALUE}, + {XRT_INPUT_TOUCH_THUMBSTICK_CLICK, XRT_INPUT_INDEX_THUMBSTICK_CLICK}, + {XRT_INPUT_TOUCH_THUMBSTICK_TOUCH, XRT_INPUT_INDEX_THUMBSTICK_TOUCH}, + {XRT_INPUT_TOUCH_THUMBSTICK, XRT_INPUT_INDEX_THUMBSTICK}, + {XRT_INPUT_TOUCH_THUMBREST_TOUCH, XRT_INPUT_INDEX_TRACKPAD_TOUCH}, // Best emulation + {XRT_INPUT_TOUCH_GRIP_POSE, XRT_INPUT_INDEX_GRIP_POSE}, + {XRT_INPUT_TOUCH_AIM_POSE, XRT_INPUT_INDEX_AIM_POSE}, +}; + +static struct xrt_binding_output_pair touch_outputs_index[1] = { + {XRT_OUTPUT_NAME_TOUCH_HAPTIC, XRT_OUTPUT_NAME_INDEX_HAPTIC}, +}; + // Exported to drivers. -struct xrt_binding_profile vive_binding_profiles_index[1] = { +struct xrt_binding_profile vive_binding_profiles_index[2] = { + { + .name = XRT_DEVICE_TOUCH_CONTROLLER, + .inputs = touch_inputs_index, + .input_count = ARRAY_SIZE(touch_inputs_index), + .outputs = touch_outputs_index, + .output_count = ARRAY_SIZE(touch_outputs_index), + }, { .name = XRT_DEVICE_SIMPLE_CONTROLLER, .inputs = simple_inputs_index,