summaryrefslogtreecommitdiffstats
path: root/src/iphone.c
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-01-29 18:02:04 +0100
committerGravatar Jonathan Beck2009-01-29 18:02:04 +0100
commitc1b2004461aaf2912af749620e7504345bf409ba (patch)
tree2c238a2d8c1598265a07a2fd52beec0939d08a73 /src/iphone.c
parent0934d1ac021dfb7907e4b580b38aa4a938cf2180 (diff)
parentf7fbac7803c5cb5934aab58925babc70af4ab848 (diff)
downloadlibimobiledevice-c1b2004461aaf2912af749620e7504345bf409ba.tar.gz
libimobiledevice-c1b2004461aaf2912af749620e7504345bf409ba.tar.bz2
Merge branch 'master' into contact_sync
Conflicts: src/Makefile.am src/iphone.c src/lockdown.c src/lockdown.h src/utils.c
Diffstat (limited to 'src/iphone.c')
-rw-r--r--src/iphone.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/iphone.c b/src/iphone.c
index 1f68180..6eb56f7 100644
--- a/src/iphone.c
+++ b/src/iphone.c
@@ -38,6 +38,8 @@
static void iphone_config_usb_device(iphone_device_t phone)
{
int ret;
+ int bytes;
+ unsigned char buf[512];
log_debug_msg("setting configuration... ");
ret = usb_set_configuration(phone->device, 3);
@@ -70,6 +72,14 @@ static void iphone_config_usb_device(iphone_device_t phone)
} else {
log_debug_msg("done.\n");
}
+
+ do {
+ bytes = usb_bulk_read(phone->device, BULKIN, (void *) &buf, 512, 800);
+ if (bytes > 0) {
+ log_debug_msg("iphone_config_usb_device: initial read returned %d bytes of data.\n", bytes);
+ log_debug_buffer(buf, bytes);
+ }
+ } while (bytes > 0);
}
/**
@@ -151,7 +161,7 @@ static iphone_error_t iphone_get_specific_device(unsigned int bus_n, int dev_n,
// 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;
@@ -219,12 +229,14 @@ iphone_error_t iphone_free_device(iphone_device_t device)
int bytes;
unsigned char buf[512];
- // read final package
- bytes = usb_bulk_read(device->device, BULKIN, (void *) &buf, 512, 1000);
- if (bytes > 0) {
- log_debug_msg("iphone_free_device: final read returned\n");
- log_debug_buffer(buf, bytes);
- }
+ // read final package(s)
+ do {
+ bytes = usb_bulk_read(device->device, BULKIN, (void *) &buf, 512, 800);
+ if (bytes > 0) {
+ log_debug_msg("iphone_free_device: final read returned\n");
+ log_debug_buffer(buf, bytes);
+ }
+ } while (bytes > 0);
if (device->buffer) {
free(device->buffer);