From 1a0c910cb8e6d2fe1c5ba970cfeb49e2cd38e747 Mon Sep 17 00:00:00 2001 From: Lukasz Rymanowski Date: Wed, 7 May 2014 02:02:14 +0200 Subject: [PATCH] android: Add possibility to start android daemon on PC in single mode With this patch it is possible to start android daemon on PC in BREDR or LE or BREDR/LE mode by setting system environment variable named BLUETOOTH_MODE to appropriate value according to README. This is useful for testing purposes. --- android/cutils/properties.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/android/cutils/properties.h b/android/cutils/properties.h index 66a4a8438..8096b19af 100644 --- a/android/cutils/properties.h +++ b/android/cutils/properties.h @@ -29,9 +29,27 @@ #define PROPERTY_VALUE_MAX 32 +#define BLUETOOTH_MODE_PROPERTY_NAME "persist.sys.bluetooth.mode" + static inline int property_get(const char *key, char *value, const char *default_value) { + const char *prop = NULL; + + if (!strcmp(key, BLUETOOTH_MODE_PROPERTY_NAME)) + prop = getenv("BLUETOOTH_MODE"); + + if (!prop) + prop = default_value; + + if (prop) { + strncpy(value, prop, PROPERTY_VALUE_MAX); + + value[PROPERTY_VALUE_MAX - 1] = '\0'; + + return strlen(value); + } + return 0; } -- 2.47.3