···314314}
315315316316mnd_result_t
317317-mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_device_id)
317317+mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_index)
318318{
319319 CHECK_NOT_NULL(root);
320320 CHECK_NOT_NULL(role_name);
321321- CHECK_NOT_NULL(out_device_id);
321321+ CHECK_NOT_NULL(out_index);
322322323323 enum role_enum role;
324324···341341#undef TO_ENUM
342342343343 switch (role) {
344344- case ROLE_HEAD: *out_device_id = root->ipc_c.ism->roles.head; return MND_SUCCESS;
345345- case ROLE_EYES: *out_device_id = root->ipc_c.ism->roles.eyes; return MND_SUCCESS;
346346- case ROLE_HAND_LEFT: *out_device_id = root->ipc_c.ism->roles.hand_tracking.left; return MND_SUCCESS;
347347- case ROLE_HAND_RIGHT: *out_device_id = root->ipc_c.ism->roles.hand_tracking.right; return MND_SUCCESS;
344344+ case ROLE_HEAD: *out_index = root->ipc_c.ism->roles.head; return MND_SUCCESS;
345345+ case ROLE_EYES: *out_index = root->ipc_c.ism->roles.eyes; return MND_SUCCESS;
346346+ case ROLE_HAND_LEFT: *out_index = root->ipc_c.ism->roles.hand_tracking.left; return MND_SUCCESS;
347347+ case ROLE_HAND_RIGHT: *out_index = root->ipc_c.ism->roles.hand_tracking.right; return MND_SUCCESS;
348348 case ROLE_LEFT:
349349 case ROLE_RIGHT:
350350 case ROLE_GAMEPAD: break;
···359359360360 // Assumes roles index match device id.
361361 switch (role) {
362362- case ROLE_LEFT: *out_device_id = roles.left; return MND_SUCCESS;
363363- case ROLE_RIGHT: *out_device_id = roles.right; return MND_SUCCESS;
364364- case ROLE_GAMEPAD: *out_device_id = roles.gamepad; return MND_SUCCESS;
362362+ case ROLE_LEFT: *out_index = roles.left; return MND_SUCCESS;
363363+ case ROLE_RIGHT: *out_index = roles.right; return MND_SUCCESS;
364364+ case ROLE_GAMEPAD: *out_index = roles.gamepad; return MND_SUCCESS;
365365 default: PE("Internal error, shouldn't get here"); return MND_ERROR_OPERATION_FAILED;
366366 }
367367}
+7-6
src/xrt/targets/libmonado/monado.h
···232232/*!
233233 * Get the device index associated for a given role name.
234234 *
235235- * @param root The libmonado state.
236236- * @param role_name Name of the role, one-of
237237- * "head","left","right"."gamepad","eyes","hand-tracking-left","hand-tracking-right"
238238- * @param[out] out_device_id Pointer to value to populate with the device id associated with given role name, -1 if not
239239- * role is set.
235235+ * @param root The libmonado state.
236236+ * @param role_name Name of the role, one-of: "head", "left", "right",
237237+ * "gamepad", "eyes", "hand-tracking-left", and,
238238+ * "hand-tracking-right":
239239+ * @param[out] out_index Pointer to value to populate with the device index
240240+ * associated with given role name, -1 if not role is set.
240241 *
241242 * @return MND_SUCCESS on success
242243 */
243244mnd_result_t
244244-mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_device_id);
245245+mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_index);
245246246247/*!
247248 * Trigger a recenter of the local spaces.