summaryrefslogtreecommitdiff
path: root/android/bluetoothd-wrapper.c
diff options
context:
space:
mode:
authorLukasz Rymanowski <lukasz.rymanowski@tieto.com>2014-03-06 10:38:00 +0100
committerSzymon Janc <szymon.janc@tieto.com>2014-03-10 10:18:35 +0100
commit67b4f4778b34cb06315fa0e30eabf5264650f007 (patch)
tree14899267cd51ec1f5f86f3455735bd388763e0db /android/bluetoothd-wrapper.c
parent7373c4f011898c0d0c3a144d524d9be27652f31a (diff)
downloadbluez-67b4f4778b34cb06315fa0e30eabf5264650f007.tar.gz
android: Add possible to enable BlueZ debug logs
With this patch it is possible to enable BlueZ logs. In order to enable it is required to set property: persist.sys.bluetooth.debug to 1 or literaly "true". More info in README
Diffstat (limited to 'android/bluetoothd-wrapper.c')
-rw-r--r--android/bluetoothd-wrapper.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/android/bluetoothd-wrapper.c b/android/bluetoothd-wrapper.c
index 3a9f32e3e..56b8a78d9 100644
--- a/android/bluetoothd-wrapper.c
+++ b/android/bluetoothd-wrapper.c
@@ -24,6 +24,8 @@
#define PROPERTY_VALGRIND_NAME "persist.sys.bluetooth.valgrind"
+#define PROPERTY_DEBUG_NAME "persist.sys.bluetooth.debug"
+
#define VALGRIND_BIN "/system/bin/valgrind"
#define BLUETOOTHD_BIN "/system/bin/bluetoothd-main"
@@ -45,13 +47,14 @@ static void run_valgrind(void)
execve(prg_argv[0], prg_argv, prg_envp);
}
-static void run_bluetoothd(void)
+static void run_bluetoothd(int debug)
{
- char *prg_argv[2];
+ char *prg_argv[3];
char *prg_envp[1];
prg_argv[0] = BLUETOOTHD_BIN;
- prg_argv[1] = NULL;
+ prg_argv[1] = debug ? "-d" : NULL;
+ prg_argv[2] = NULL;
prg_envp[0] = NULL;
@@ -61,16 +64,20 @@ static void run_bluetoothd(void)
int main(int argc, char *argv[])
{
char value[PROPERTY_VALUE_MAX];
+ int debug = 0;
if (property_get(PROPERTY_VALGRIND_NAME, value, "") > 0 &&
(!strcasecmp(value, "true") || atoi(value) > 0))
run_valgrind();
+ if (property_get(PROPERTY_DEBUG_NAME, value, "") > 0 &&
+ (!strcasecmp(value, "true") || atoi(value) > 0))
+ debug = 1;
+
/* In case we failed to execute Valgrind, try to run bluetoothd
* without it
*/
-
- run_bluetoothd();
+ run_bluetoothd(debug);
return 0;
}