diff options
author | Nikias Bassen | 2009-04-14 13:15:10 +0200 |
---|---|---|
committer | Nikias Bassen | 2009-04-14 13:15:10 +0200 |
commit | a5245005b41cbae1ccee805fbef8d3e343c9b312 (patch) | |
tree | e0f33650370132efc5d909ca032887690f2cf302 /iphone.c | |
parent | 9932dadfc7ddc65ccb3d2988df1a6dcc9cf536c5 (diff) | |
download | usbmuxd-a5245005b41cbae1ccee805fbef8d3e343c9b312.tar.gz usbmuxd-a5245005b41cbae1ccee805fbef8d3e343c9b312.tar.bz2 |
Logging and debugging refined.
Diffstat (limited to 'iphone.c')
-rw-r--r-- | iphone.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -143,7 +143,8 @@ void log_debug_msg(const char *format, ...) */ static void print_buffer(const char *data, const int length) { - int i; + if (toto_debug > 0) { + int i; int j; unsigned char c; @@ -170,6 +171,7 @@ static void print_buffer(const char *data, const int length) printf("\n"); } printf("\n"); + } } #endif @@ -356,7 +358,7 @@ iphone_error_t iphone_get_specific_device(int bus_n, int dev_n, iphone_device_t // Check for correct version if (ntohl(version->major) == 1 && ntohl(version->minor) == 0) { // We're all ready to roll. - fprintf(stderr, "get_iPhone() success\n"); + log_debug_msg("get_iPhone() success\n"); free(version); *device = phone; return IPHONE_E_SUCCESS; @@ -513,10 +515,12 @@ int send_to_phone(iphone_device_t phone, char *data, int datalen) #ifdef DEBUG if (bytes > 0) { + if (toto_debug > 0) { printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); printf("%s: sent to phone\n", __func__); print_buffer(data, bytes); printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); + } } #endif return bytes; @@ -553,10 +557,12 @@ int recv_from_phone_timeout(iphone_device_t phone, char *data, int datalen, int #ifdef DEBUG if (bytes > 0) { + if (toto_debug > 0) { printf("<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); printf("%s: received from phone:\n", __func__); print_buffer(data, bytes); printf("<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); + } } #endif |