diff --git a/src/xrt/targets/libmonado/monado.c b/src/xrt/targets/libmonado/monado.c index e3888d253..265967972 100644 --- a/src/xrt/targets/libmonado/monado.c +++ b/src/xrt/targets/libmonado/monado.c @@ -314,11 +314,11 @@ mnd_root_get_device_info(mnd_root_t *root, uint32_t device_index, uint32_t *out_ } mnd_result_t -mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_device_id) +mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_index) { CHECK_NOT_NULL(root); CHECK_NOT_NULL(role_name); - CHECK_NOT_NULL(out_device_id); + CHECK_NOT_NULL(out_index); enum role_enum role; @@ -341,10 +341,10 @@ mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t * #undef TO_ENUM switch (role) { - case ROLE_HEAD: *out_device_id = root->ipc_c.ism->roles.head; return MND_SUCCESS; - case ROLE_EYES: *out_device_id = root->ipc_c.ism->roles.eyes; return MND_SUCCESS; - case ROLE_HAND_LEFT: *out_device_id = root->ipc_c.ism->roles.hand_tracking.left; return MND_SUCCESS; - case ROLE_HAND_RIGHT: *out_device_id = root->ipc_c.ism->roles.hand_tracking.right; return MND_SUCCESS; + case ROLE_HEAD: *out_index = root->ipc_c.ism->roles.head; return MND_SUCCESS; + case ROLE_EYES: *out_index = root->ipc_c.ism->roles.eyes; return MND_SUCCESS; + case ROLE_HAND_LEFT: *out_index = root->ipc_c.ism->roles.hand_tracking.left; return MND_SUCCESS; + case ROLE_HAND_RIGHT: *out_index = root->ipc_c.ism->roles.hand_tracking.right; return MND_SUCCESS; case ROLE_LEFT: case ROLE_RIGHT: case ROLE_GAMEPAD: break; @@ -359,9 +359,9 @@ mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t * // Assumes roles index match device id. switch (role) { - case ROLE_LEFT: *out_device_id = roles.left; return MND_SUCCESS; - case ROLE_RIGHT: *out_device_id = roles.right; return MND_SUCCESS; - case ROLE_GAMEPAD: *out_device_id = roles.gamepad; return MND_SUCCESS; + case ROLE_LEFT: *out_index = roles.left; return MND_SUCCESS; + case ROLE_RIGHT: *out_index = roles.right; return MND_SUCCESS; + case ROLE_GAMEPAD: *out_index = roles.gamepad; return MND_SUCCESS; default: PE("Internal error, shouldn't get here"); return MND_ERROR_OPERATION_FAILED; } } diff --git a/src/xrt/targets/libmonado/monado.h b/src/xrt/targets/libmonado/monado.h index 43234e6ff..b9f8eb005 100644 --- a/src/xrt/targets/libmonado/monado.h +++ b/src/xrt/targets/libmonado/monado.h @@ -232,16 +232,17 @@ mnd_root_get_device_info(mnd_root_t *root, uint32_t device_index, uint32_t *out_ /*! * Get the device index associated for a given role name. * - * @param root The libmonado state. - * @param role_name Name of the role, one-of - * "head","left","right"."gamepad","eyes","hand-tracking-left","hand-tracking-right" - * @param[out] out_device_id Pointer to value to populate with the device id associated with given role name, -1 if not - * role is set. + * @param root The libmonado state. + * @param role_name Name of the role, one-of: "head", "left", "right", + * "gamepad", "eyes", "hand-tracking-left", and, + * "hand-tracking-right": + * @param[out] out_index Pointer to value to populate with the device index + * associated with given role name, -1 if not role is set. * * @return MND_SUCCESS on success */ mnd_result_t -mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_device_id); +mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_index); /*! * Trigger a recenter of the local spaces.