summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/debug.c19
-rw-r--r--include/libimobiledevice/libimobiledevice.h10
-rw-r--r--src/idevice.c6
-rw-r--r--src/idevice.h3
4 files changed, 18 insertions, 20 deletions
diff --git a/common/debug.c b/common/debug.c
index 8ad0f08..c4d3897 100644
--- a/common/debug.c
+++ b/common/debug.c
@@ -41,19 +41,6 @@
#define MAX_PRINT_LEN 16*1024
-int debug_level = 0;
-
-/**
- * Sets the level of debugging. Currently the only acceptable values are 0 and
- * 1.
- *
- * @param level Set to 0 for no debugging or 1 for debugging.
- */
-LIBIMOBILEDEVICE_API void idevice_set_debug_level(int level)
-{
- debug_level = level;
-}
-
#ifndef STRIP_DEBUG_CODE
static void debug_print_line(const char *func, const char *file, int line, const char *buffer)
{
@@ -90,7 +77,7 @@ void debug_info_real(const char *func, const char *file, int line, const char *f
va_list args;
char *buffer = NULL;
- if (!debug_level)
+ if (!idevice_debug_level)
return;
/* run the real fprintf */
@@ -111,7 +98,7 @@ void debug_buffer(const char *data, const int length)
int j;
unsigned char c;
- if (debug_level) {
+ if (idevice_debug_level) {
for (i = 0; i < length; i += 16) {
fprintf(stderr, "%04x: ", i);
for (j = 0; j < 16; j++) {
@@ -142,7 +129,7 @@ void debug_buffer(const char *data, const int length)
void debug_buffer_to_file(const char *file, const char *data, const int length)
{
#ifndef STRIP_DEBUG_CODE
- if (debug_level) {
+ if (idevice_debug_level) {
FILE *f = fopen(file, "wb");
fwrite(data, 1, length, f);
fflush(f);
diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h
index c91ec83..b7a20d8 100644
--- a/include/libimobiledevice/libimobiledevice.h
+++ b/include/libimobiledevice/libimobiledevice.h
@@ -49,9 +49,6 @@ typedef idevice_private *idevice_t; /**< The device handle. */
typedef struct idevice_connection_private idevice_connection_private;
typedef idevice_connection_private *idevice_connection_t; /**< The connection handle. */
-/* generic */
-void idevice_set_debug_level(int level);
-
/* discovery (events/asynchronous) */
/** The event type for device add or removal */
enum idevice_event_type {
@@ -74,6 +71,13 @@ typedef void (*idevice_event_cb_t) (const idevice_event_t *event, void *user_dat
/* functions */
/**
+ * Set the level of debugging.
+ *
+ * @param level Set to 0 for no debug output or 1 to enable debug output.
+ */
+void idevice_set_debug_level(int level);
+
+/**
* Register a callback function that will be called when device add/remove
* events occur.
*
diff --git a/src/idevice.c b/src/idevice.c
index 7ec46ed..c40c59a 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -44,6 +44,7 @@
#else
#include <gnutls/gnutls.h>
#endif
+
#include "idevice.h"
#include "common/userpref.h"
#include "common/thread.h"
@@ -221,6 +222,11 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_device_list_free(char **devices)
return IDEVICE_E_SUCCESS;
}
+LIBIMOBILEDEVICE_API void idevice_set_debug_level(int level)
+{
+ idevice_debug_level = level;
+}
+
LIBIMOBILEDEVICE_API idevice_error_t idevice_new(idevice_t * device, const char *udid)
{
usbmuxd_device_info_t muxdev;
diff --git a/src/idevice.h b/src/idevice.h
index 575e313..1a52480 100644
--- a/src/idevice.h
+++ b/src/idevice.h
@@ -44,9 +44,10 @@
#endif
#include "common/userpref.h"
-
#include "libimobiledevice/libimobiledevice.h"
+int idevice_debug_level;
+
enum connection_type {
CONNECTION_USBMUXD = 1
};