t/libmonado: add tracking-related device properties

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2313>
This commit is contained in:
galister 2024-08-27 20:53:11 +09:00 committed by Marge Bot
parent 235cc78e6a
commit 6db9d570d8
2 changed files with 22 additions and 5 deletions

View file

@ -306,9 +306,15 @@ mnd_root_get_device_info_bool(mnd_root_t *root, uint32_t device_index, mnd_prope
return MND_ERROR_INVALID_VALUE;
}
PE("Is not a valid boolean property (%u)", prop);
const struct ipc_shared_device *shared_device = &root->ipc_c.ism->isdevs[device_index];
return MND_ERROR_INVALID_PROPERTY;
switch (prop) {
case MND_PROPERTY_SUPPORTS_POSITION_BOOL: *out_bool = shared_device->position_tracking_supported; break;
case MND_PROPERTY_SUPPORTS_ORIENTATION_BOOL: *out_bool = shared_device->orientation_tracking_supported; break;
default: PE("Is not a valid boolean property (%u)", prop); return MND_ERROR_INVALID_PROPERTY;
}
return MND_SUCCESS;
}
mnd_result_t
@ -338,9 +344,14 @@ mnd_root_get_device_info_u32(mnd_root_t *root, uint32_t device_index, mnd_proper
return MND_ERROR_INVALID_VALUE;
}
PE("Is not a valid u32 property (%u)", prop);
const struct ipc_shared_device *shared_device = &root->ipc_c.ism->isdevs[device_index];
return MND_ERROR_INVALID_PROPERTY;
switch (prop) {
case MND_PROPERTY_TRACKING_ORIGIN_U32: *out_u32 = shared_device->tracking_origin_index; break;
default: PE("Is not a valid u32 property (%u)", prop); return MND_ERROR_INVALID_PROPERTY;
}
return MND_SUCCESS;
}
mnd_result_t

View file

@ -25,7 +25,7 @@ extern "C" {
//! Major version of the API.
#define MND_API_VERSION_MAJOR 1
//! Minor version of the API.
#define MND_API_VERSION_MINOR 3
#define MND_API_VERSION_MINOR 4
//! Patch version of the API.
#define MND_API_VERSION_PATCH 0
@ -72,6 +72,12 @@ typedef enum mnd_property
MND_PROPERTY_NAME_STRING = 0,
//! Supported in version 1.2 and above.
MND_PROPERTY_SERIAL_STRING = 1,
//! Supported in version 1.4.0 and above.
MND_PROPERTY_TRACKING_ORIGIN_U32 = 2,
//! Supported in version 1.4.0 and above.
MND_PROPERTY_SUPPORTS_POSITION_BOOL = 3,
//! Supported in version 1.4.0 and above.
MND_PROPERTY_SUPPORTS_ORIENTATION_BOOL = 4,
} mnd_property_t;
/*!