summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-12-27 21:14:39 +0100
committerMarcel Holtmann <marcel@holtmann.org>2015-12-27 21:14:39 +0100
commite002e80f55217e825d6b8a1c6d27b3b781b5e850 (patch)
treebbe54c6278773ad32f5470aadd0938a50ec83e36
parent1b9e48f4c2b98ea88e43bd493c098dcca822a1d0 (diff)
downloadbluez-e002e80f55217e825d6b8a1c6d27b3b781b5e850.tar.gz
tools: Add support for MGMT_DEBUG environment variable
-rw-r--r--tools/btmgmt.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index fc8f0e37a..f82461ed7 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -4640,6 +4640,13 @@ static struct io *setup_stdin(void)
return io;
}
+static void mgmt_debug(const char *str, void *user_data)
+{
+ const char *prefix = user_data;
+
+ print("%s%s", prefix, str);
+}
+
int main(int argc, char *argv[])
{
struct io *input;
@@ -4675,6 +4682,9 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
+ if (getenv("MGMT_DEBUG"))
+ mgmt_set_debug(mgmt, mgmt_debug, "mgmt: ", NULL);
+
if (argc > 0) {
struct cmd_info *c;