mirror of
https://github.com/lbgos/rift-s-linux.git
synced 2026-10-29 04:02:05 +01:00
u/debug: Use system property on Android for debug settings
Co-authored-by: Jakob Bornecrantz <jakob@collabora.com>
This commit is contained in:
1 parent
2f3f533082
commit
a8df7dcb54
1 file changed
+37
@@ -19,6 +19,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef XRT_OS_ANDROID
|
||||
#include <sys/system_properties.h>
|
||||
#endif
|
||||
|
||||
|
||||
DEBUG_GET_ONCE_BOOL_OPTION(print, "XRT_PRINT_OPTIONS", false)
|
||||
|
||||
@@ -44,6 +48,39 @@ get_option_raw(char *chars, size_t char_count, const char *name)
|
||||
return chars;
|
||||
}
|
||||
|
||||
#elif defined XRT_OS_ANDROID
|
||||
|
||||
struct android_read_arg
|
||||
{
|
||||
char *chars;
|
||||
size_t char_count;
|
||||
};
|
||||
|
||||
static void
|
||||
android_on_property_read(void *cookie, const char *name, const char *value, uint32_t serial)
|
||||
{
|
||||
struct android_read_arg *a = (struct android_read_arg *)cookie;
|
||||
|
||||
snprintf(a->chars, a->char_count, "%s", value);
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_option_raw(char *chars, size_t char_count, const char *name)
|
||||
{
|
||||
char prefixed[1024];
|
||||
snprintf(prefixed, ARRAY_SIZE(prefixed), "debug.xrt.%s", name);
|
||||
|
||||
const struct prop_info *pi = __system_property_find(prefixed);
|
||||
if (pi == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct android_read_arg a = {.chars = chars, .char_count = char_count};
|
||||
__system_property_read_callback(pi, &android_on_property_read, &a);
|
||||
|
||||
return chars;
|
||||
}
|
||||
|
||||
#elif defined XRT_OS_LINUX
|
||||
|
||||
static const char *
|
||||
|
||||
Reference in new issue
Block a user