The open source OpenXR runtime
0
fork

Configure Feed

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

t/libmonado: Tidy mnd_root_get_device_from_role [NFC]

Tidy both documentation and code.

+16 -15
+9 -9
src/xrt/targets/libmonado/monado.c
··· 314 314 } 315 315 316 316 mnd_result_t 317 - mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_device_id) 317 + mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_index) 318 318 { 319 319 CHECK_NOT_NULL(root); 320 320 CHECK_NOT_NULL(role_name); 321 - CHECK_NOT_NULL(out_device_id); 321 + CHECK_NOT_NULL(out_index); 322 322 323 323 enum role_enum role; 324 324 ··· 341 341 #undef TO_ENUM 342 342 343 343 switch (role) { 344 - case ROLE_HEAD: *out_device_id = root->ipc_c.ism->roles.head; return MND_SUCCESS; 345 - case ROLE_EYES: *out_device_id = root->ipc_c.ism->roles.eyes; return MND_SUCCESS; 346 - case ROLE_HAND_LEFT: *out_device_id = root->ipc_c.ism->roles.hand_tracking.left; return MND_SUCCESS; 347 - case ROLE_HAND_RIGHT: *out_device_id = root->ipc_c.ism->roles.hand_tracking.right; return MND_SUCCESS; 344 + case ROLE_HEAD: *out_index = root->ipc_c.ism->roles.head; return MND_SUCCESS; 345 + case ROLE_EYES: *out_index = root->ipc_c.ism->roles.eyes; return MND_SUCCESS; 346 + case ROLE_HAND_LEFT: *out_index = root->ipc_c.ism->roles.hand_tracking.left; return MND_SUCCESS; 347 + case ROLE_HAND_RIGHT: *out_index = root->ipc_c.ism->roles.hand_tracking.right; return MND_SUCCESS; 348 348 case ROLE_LEFT: 349 349 case ROLE_RIGHT: 350 350 case ROLE_GAMEPAD: break; ··· 359 359 360 360 // Assumes roles index match device id. 361 361 switch (role) { 362 - case ROLE_LEFT: *out_device_id = roles.left; return MND_SUCCESS; 363 - case ROLE_RIGHT: *out_device_id = roles.right; return MND_SUCCESS; 364 - case ROLE_GAMEPAD: *out_device_id = roles.gamepad; return MND_SUCCESS; 362 + case ROLE_LEFT: *out_index = roles.left; return MND_SUCCESS; 363 + case ROLE_RIGHT: *out_index = roles.right; return MND_SUCCESS; 364 + case ROLE_GAMEPAD: *out_index = roles.gamepad; return MND_SUCCESS; 365 365 default: PE("Internal error, shouldn't get here"); return MND_ERROR_OPERATION_FAILED; 366 366 } 367 367 }
+7 -6
src/xrt/targets/libmonado/monado.h
··· 232 232 /*! 233 233 * Get the device index associated for a given role name. 234 234 * 235 - * @param root The libmonado state. 236 - * @param role_name Name of the role, one-of 237 - * "head","left","right"."gamepad","eyes","hand-tracking-left","hand-tracking-right" 238 - * @param[out] out_device_id Pointer to value to populate with the device id associated with given role name, -1 if not 239 - * role is set. 235 + * @param root The libmonado state. 236 + * @param role_name Name of the role, one-of: "head", "left", "right", 237 + * "gamepad", "eyes", "hand-tracking-left", and, 238 + * "hand-tracking-right": 239 + * @param[out] out_index Pointer to value to populate with the device index 240 + * associated with given role name, -1 if not role is set. 240 241 * 241 242 * @return MND_SUCCESS on success 242 243 */ 243 244 mnd_result_t 244 - mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_device_id); 245 + mnd_root_get_device_from_role(mnd_root_t *root, const char *role_name, int32_t *out_index); 245 246 246 247 /*! 247 248 * Trigger a recenter of the local spaces.