From 67b4f4778b34cb06315fa0e30eabf5264650f007 Mon Sep 17 00:00:00 2001 From: Lukasz Rymanowski Date: Thu, 6 Mar 2014 10:38:00 +0100 Subject: 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 --- android/bluetoothd-wrapper.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'android/bluetoothd-wrapper.c') 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; } -- cgit v1.2.1