diff --git a/android/README b/android/README
index 3095383..b7ecf5f 100644
--- a/android/README
+++ b/android/README
have proper library installed automatically by appropriate entry in Android.mk,
see https://code.google.com/p/aosp-bluez.glib/ for an example.
+Enabling BlueZ debugs
+==============================
+
+BlueZ debug logs can be enabled in runtime by setting "persist.sys.bluetooth.debug"
+property to either literal "true" or any numeric value >0. For example:
+adb root
+adb shell setprop persist.sys.bluetooth.debug 1
+
+After changing property value Bluetooth needs to be restarted to apply changes.
+
+Note: Debugs are only available on NON USER build variants
=============================
Building and running on Linux
=============================
diff --git a/android/bluetoothd-wrapper.c b/android/bluetoothd-wrapper.c
index 3a9f32e..56b8a78 100644
--- a/android/bluetoothd-wrapper.c
+++ b/android/bluetoothd-wrapper.c
#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"
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;
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;
}
diff --git a/android/main.c b/android/main.c
index 42bc982..edec7dc 100644
--- a/android/main.c
+++ b/android/main.c
static gboolean option_version = FALSE;
static gint option_index = -1;
+static gboolean option_dbg = FALSE;
static GOptionEntry options[] = {
{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
"Show version information and exit", NULL },
{ "index", 'i', 0, G_OPTION_ARG_INT, &option_index,
"Use specified controller", "INDEX"},
+ { "debug", 'd', 0, G_OPTION_ARG_NONE, &option_dbg,
+ "Enable debug logs", NULL},
{ NULL }
};
if (!signal)
return EXIT_FAILURE;
- __btd_log_init("*", 0);
+ if (option_dbg)
+ __btd_log_init("*", 0);
+ else
+ __btd_log_init(NULL, 0);
if (!set_capabilities()) {
__btd_log_cleanup();