From c244cd7da7b0339858a3dc2e3ad99a760be1df67 Mon Sep 17 00:00:00 2001
From: Jakob Olsson <jakobols@kth.se>
Date: Mon, 21 May 2018 10:00:09 +0200
Subject: [PATCH] move debug from library to application

---
 common.h    |  8 ++++++++
 dongle.c    |  1 +
 libmobile.h | 12 +-----------
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/common.h b/common.h
index 6d1eeb0..8d20ba8 100644
--- a/common.h
+++ b/common.h
@@ -20,6 +20,14 @@
 #include <libubox/blobmsg.h>
 #include <libubus.h>
 
+extern int debug;
+
+#define debug_print(...)                  \
+	do                                    \
+	{                                     \
+		if (debug)                        \
+			fprintf(stderr, __VA_ARGS__); \
+	} while (0)
 /**
  * Function: print_to_ubus
  *
diff --git a/dongle.c b/dongle.c
index 89c3ea8..b753547 100644
--- a/dongle.c
+++ b/dongle.c
@@ -4,6 +4,7 @@
 #include "dongle_network.h"
 
 struct ubus_context *ctx;
+int debug;
 
 static struct option long_options[] =
 {
diff --git a/libmobile.h b/libmobile.h
index 6809833..b5c3b4a 100644
--- a/libmobile.h
+++ b/libmobile.h
@@ -4,16 +4,6 @@
 #include <json-c/json.h>
 #include <string.h>
 
-int debug;
-//#define DEBUG 1 //how to define from some sort of config? there is no main?
-#define debug_print(...)                  \
-	do                                    \
-	{                                     \
-		if (debug)                        \
-			fprintf(stderr, __VA_ARGS__); \
-	} while (0)
-
-
 /***************************************************
  * Libmobile - A 4G Dongle library
  *
@@ -269,4 +259,4 @@ struct json_object *mobile_set_pin(char *current_pin, char *new_pin);
  *		NULL on failure.
  */
 struct json_object *mobile_disable_pin(char *pin);
-#endif
\ No newline at end of file
+#endif
-- 
GitLab