The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/ohmd: Fix input from controls_mapping[0].

Use INPUT_INDICES_LAST instead of 0 for checking if control_mapping[i]
is unassigned for index i, ie. for skipping input.

As 0 is a valid mapping assignment defined in "enum input_indices", this
lead to dead input for SIMPLE_SELECT_CLICK and OCULUS_TOUCH_X_CLICK, both
assigned to 0.

This commit makes the Oculus Rift CV-1 left touch controllers X-Button
work in Monado OpenXR native and SteamVR via. Monado driver plugin.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>

authored by

Mario Kleiner and committed by
Christoph Haag
50f7b5ba cb94bc2d

+6 -6
+6 -6
src/xrt/drivers/ohmd/oh_device.c
··· 205 205 206 206 #define CASE_VEC1(OHMD_CONTROL) \ 207 207 case OHMD_CONTROL: \ 208 - if (ohd->controls_mapping[OHMD_CONTROL] == 0) { \ 208 + if (ohd->controls_mapping[OHMD_CONTROL] == INPUT_INDICES_LAST) { \ 209 209 break; \ 210 210 } \ 211 211 if (control_state[i] != ohd->last_control_state[i]) { \ ··· 216 216 217 217 #define CASE_VEC1_OR_DIGITAL(OHMD_CONTROL, MAKE_DIGITAL) \ 218 218 case OHMD_CONTROL: \ 219 - if (ohd->controls_mapping[OHMD_CONTROL] == 0) { \ 219 + if (ohd->controls_mapping[OHMD_CONTROL] == INPUT_INDICES_LAST) { \ 220 220 break; \ 221 221 } \ 222 222 if (MAKE_DIGITAL) { \ ··· 236 236 237 237 #define CASE_DIGITAL(OHMD_CONTROL, THRESHOLD) \ 238 238 case OHMD_CONTROL: \ 239 - if (ohd->controls_mapping[OHMD_CONTROL] == 0) { \ 239 + if (ohd->controls_mapping[OHMD_CONTROL] == INPUT_INDICES_LAST) { \ 240 240 break; \ 241 241 } \ 242 242 if (control_state[i] != ohd->last_control_state[i]) { \ ··· 248 248 249 249 #define CASE_VEC2_X(OHMD_CONTROL) \ 250 250 case OHMD_CONTROL: \ 251 - if (ohd->controls_mapping[OHMD_CONTROL] == 0) { \ 251 + if (ohd->controls_mapping[OHMD_CONTROL] == INPUT_INDICES_LAST) { \ 252 252 break; \ 253 253 } \ 254 254 if (control_state[i] != ohd->last_control_state[i]) { \ ··· 259 259 260 260 #define CASE_VEC2_Y(OHMD_CONTROL) \ 261 261 case OHMD_CONTROL: \ 262 - if (ohd->controls_mapping[OHMD_CONTROL] == 0) { \ 262 + if (ohd->controls_mapping[OHMD_CONTROL] == INPUT_INDICES_LAST) { \ 263 263 break; \ 264 264 } \ 265 265 if (control_state[i] != ohd->last_control_state[i]) { \ ··· 1076 1076 ohd->enable_finite_difference = debug_get_bool_option_ohmd_finite_diff(); 1077 1077 1078 1078 for (int i = 0; i < CONTROL_MAPPING_SIZE; i++) { 1079 - ohd->controls_mapping[i] = 0; 1079 + ohd->controls_mapping[i] = INPUT_INDICES_LAST; 1080 1080 } 1081 1081 1082 1082 if (device_type == XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER ||