summaryrefslogtreecommitdiff
path: root/android/cutils
diff options
context:
space:
mode:
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>2014-05-07 02:02:14 +0200
committerSzymon Janc <szymon.janc@tieto.com>2014-05-07 16:13:36 +0200
commit1a0c910cb8e6d2fe1c5ba970cfeb49e2cd38e747 (patch)
tree05d69f82b7beeea2a3b7cec7391899e73b278467 /android/cutils
parent61d74898ae537a7ba94fe383e1582b27ef7e4d67 (diff)
downloadbluez-1a0c910cb8e6d2fe1c5ba970cfeb49e2cd38e747.tar.gz
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.
Diffstat (limited to 'android/cutils')
-rw-r--r--android/cutils/properties.h18
1 files changed, 18 insertions, 0 deletions
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;
}