summaryrefslogtreecommitdiffstats
path: root/iphone.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2009-04-14 13:15:10 +0200
committerGravatar Nikias Bassen2009-04-14 13:15:10 +0200
commita5245005b41cbae1ccee805fbef8d3e343c9b312 (patch)
treee0f33650370132efc5d909ca032887690f2cf302 /iphone.c
parent9932dadfc7ddc65ccb3d2988df1a6dcc9cf536c5 (diff)
downloadusbmuxd-a5245005b41cbae1ccee805fbef8d3e343c9b312.tar.gz
usbmuxd-a5245005b41cbae1ccee805fbef8d3e343c9b312.tar.bz2
Logging and debugging refined.
Diffstat (limited to 'iphone.c')
-rw-r--r--iphone.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/iphone.c b/iphone.c
index 662432b..db68349 100644
--- a/iphone.c
+++ b/iphone.c
@@ -143,7 +143,8 @@ void log_debug_msg(const char *format, ...)
143 */ 143 */
144static void print_buffer(const char *data, const int length) 144static void print_buffer(const char *data, const int length)
145{ 145{
146 int i; 146 if (toto_debug > 0) {
147 int i;
147 int j; 148 int j;
148 unsigned char c; 149 unsigned char c;
149 150
@@ -170,6 +171,7 @@ static void print_buffer(const char *data, const int length)
170 printf("\n"); 171 printf("\n");
171 } 172 }
172 printf("\n"); 173 printf("\n");
174 }
173} 175}
174#endif 176#endif
175 177
@@ -356,7 +358,7 @@ iphone_error_t iphone_get_specific_device(int bus_n, int dev_n, iphone_device_t
356 // Check for correct version 358 // Check for correct version
357 if (ntohl(version->major) == 1 && ntohl(version->minor) == 0) { 359 if (ntohl(version->major) == 1 && ntohl(version->minor) == 0) {
358 // We're all ready to roll. 360 // We're all ready to roll.
359 fprintf(stderr, "get_iPhone() success\n"); 361 log_debug_msg("get_iPhone() success\n");
360 free(version); 362 free(version);
361 *device = phone; 363 *device = phone;
362 return IPHONE_E_SUCCESS; 364 return IPHONE_E_SUCCESS;
@@ -513,10 +515,12 @@ int send_to_phone(iphone_device_t phone, char *data, int datalen)
513 515
514#ifdef DEBUG 516#ifdef DEBUG
515 if (bytes > 0) { 517 if (bytes > 0) {
518 if (toto_debug > 0) {
516 printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); 519 printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
517 printf("%s: sent to phone\n", __func__); 520 printf("%s: sent to phone\n", __func__);
518 print_buffer(data, bytes); 521 print_buffer(data, bytes);
519 printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); 522 printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
523 }
520 } 524 }
521#endif 525#endif
522 return bytes; 526 return bytes;
@@ -553,10 +557,12 @@ int recv_from_phone_timeout(iphone_device_t phone, char *data, int datalen, int
553 557
554#ifdef DEBUG 558#ifdef DEBUG
555 if (bytes > 0) { 559 if (bytes > 0) {
560 if (toto_debug > 0) {
556 printf("<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); 561 printf("<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
557 printf("%s: received from phone:\n", __func__); 562 printf("%s: received from phone:\n", __func__);
558 print_buffer(data, bytes); 563 print_buffer(data, bytes);
559 printf("<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); 564 printf("<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
565 }
560 } 566 }
561#endif 567#endif
562 568