The open source OpenXR runtime

t/libmonado: add tracking-related device properties

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2313>

authored by

galister and committed by
Marge Bot
6db9d570 235cc78e

+22 -5
+15 -4
src/xrt/targets/libmonado/monado.c
··· 306 306 return MND_ERROR_INVALID_VALUE; 307 307 } 308 308 309 - PE("Is not a valid boolean property (%u)", prop); 309 + const struct ipc_shared_device *shared_device = &root->ipc_c.ism->isdevs[device_index]; 310 310 311 - return MND_ERROR_INVALID_PROPERTY; 311 + switch (prop) { 312 + case MND_PROPERTY_SUPPORTS_POSITION_BOOL: *out_bool = shared_device->position_tracking_supported; break; 313 + case MND_PROPERTY_SUPPORTS_ORIENTATION_BOOL: *out_bool = shared_device->orientation_tracking_supported; break; 314 + default: PE("Is not a valid boolean property (%u)", prop); return MND_ERROR_INVALID_PROPERTY; 315 + } 316 + 317 + return MND_SUCCESS; 312 318 } 313 319 314 320 mnd_result_t ··· 338 344 return MND_ERROR_INVALID_VALUE; 339 345 } 340 346 341 - PE("Is not a valid u32 property (%u)", prop); 347 + const struct ipc_shared_device *shared_device = &root->ipc_c.ism->isdevs[device_index]; 348 + 349 + switch (prop) { 350 + case MND_PROPERTY_TRACKING_ORIGIN_U32: *out_u32 = shared_device->tracking_origin_index; break; 351 + default: PE("Is not a valid u32 property (%u)", prop); return MND_ERROR_INVALID_PROPERTY; 352 + } 342 353 343 - return MND_ERROR_INVALID_PROPERTY; 354 + return MND_SUCCESS; 344 355 } 345 356 346 357 mnd_result_t
+7 -1
src/xrt/targets/libmonado/monado.h
··· 25 25 //! Major version of the API. 26 26 #define MND_API_VERSION_MAJOR 1 27 27 //! Minor version of the API. 28 - #define MND_API_VERSION_MINOR 3 28 + #define MND_API_VERSION_MINOR 4 29 29 //! Patch version of the API. 30 30 #define MND_API_VERSION_PATCH 0 31 31 ··· 72 72 MND_PROPERTY_NAME_STRING = 0, 73 73 //! Supported in version 1.2 and above. 74 74 MND_PROPERTY_SERIAL_STRING = 1, 75 + //! Supported in version 1.4.0 and above. 76 + MND_PROPERTY_TRACKING_ORIGIN_U32 = 2, 77 + //! Supported in version 1.4.0 and above. 78 + MND_PROPERTY_SUPPORTS_POSITION_BOOL = 3, 79 + //! Supported in version 1.4.0 and above. 80 + MND_PROPERTY_SUPPORTS_ORIENTATION_BOOL = 4, 75 81 } mnd_property_t; 76 82 77 83 /*!