summaryrefslogtreecommitdiffstats
path: root/iphone.c
diff options
context:
space:
mode:
Diffstat (limited to 'iphone.c')
-rw-r--r--iphone.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/iphone.c b/iphone.c
index bf0d5de..0a2b6cc 100644
--- a/iphone.c
+++ b/iphone.c
@@ -449,9 +449,11 @@ int send_to_phone(iphone_device_t phone, char *data, int datalen)
449 int bytes = 0; 449 int bytes = 0;
450 450
451#ifdef DEBUG 451#ifdef DEBUG
452 #ifdef DEBUG_MORE
452 printf("===============================\n%s: trying to send\n", __func__); 453 printf("===============================\n%s: trying to send\n", __func__);
453 print_buffer(data, datalen); 454 print_buffer(data, datalen);
454 printf("===============================\n"); 455 printf("===============================\n");
456 #endif
455#endif 457#endif
456 do { 458 do {
457 if (retrycount > 3) { 459 if (retrycount > 3) {
@@ -980,6 +982,7 @@ uint32 append_receive_buffer(iphone_umux_client_t client, char* packet)
980 982
981 // ensure there is enough space, either by first malloc or realloc 983 // ensure there is enough space, either by first malloc or realloc
982 if (datalen > 0) { 984 if (datalen > 0) {
985 fprintf(stderr, "%s: putting %d bytes into client's recv_buffer\n", __func__, datalen);
983 if (client->r_len == 0) dobroadcast = 1; 986 if (client->r_len == 0) dobroadcast = 1;
984 987
985 if (client->recv_buffer == NULL) { 988 if (client->recv_buffer == NULL) {
@@ -1077,6 +1080,7 @@ void iphone_mux_pullbulk(iphone_device_t phone)
1077 // to construct a full packet, including its data 1080 // to construct a full packet, including its data
1078 uint32 packetlen = ntohl(header->length); 1081 uint32 packetlen = ntohl(header->length);
1079 if (usbReceive.leftover < packetlen) { 1082 if (usbReceive.leftover < packetlen) {
1083 printf("%s: not enough data to construct a full packet\n", __func__);
1080 break; 1084 break;
1081 } 1085 }
1082 1086
@@ -1087,6 +1091,7 @@ void iphone_mux_pullbulk(iphone_device_t phone)
1087 } 1091 }
1088 else { 1092 else {
1089 // stuff the data 1093 // stuff the data
1094 fprintf(stderr, "%s: found client, calling append_receive_buffer\n", __func__);
1090 append_receive_buffer(client, cursor); 1095 append_receive_buffer(client, cursor);
1091 } 1096 }
1092 1097
@@ -1104,6 +1109,7 @@ void iphone_mux_pullbulk(iphone_device_t phone)
1104 // if there are no leftovers, we just leave the datastructure as is, 1109 // if there are no leftovers, we just leave the datastructure as is,
1105 // and re-use the block next time. 1110 // and re-use the block next time.
1106 if (usbReceive.leftover > 0 && cursor != usbReceive.buffer) { 1111 if (usbReceive.leftover > 0 && cursor != usbReceive.buffer) {
1112 fprintf(stderr, "%s: we got a leftover, so handle it\n", __func__);
1107 char* newbuff = malloc(DEFAULT_CAPACITY); 1113 char* newbuff = malloc(DEFAULT_CAPACITY);
1108 memcpy(newbuff, cursor, usbReceive.leftover); 1114 memcpy(newbuff, cursor, usbReceive.leftover);
1109 free(usbReceive.buffer); 1115 free(usbReceive.buffer);