summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2012-07-17 18:07:10 +0200
committerGravatar Nikias Bassen2012-07-17 18:07:10 +0200
commit231e33d5544722d27d08261275332072769e59bc (patch)
tree9f3f712b23224b26bcf32d94e30e03fc4c905ae9
parent4e338a3126568ad3995795ea16d9955db8c6e002 (diff)
downloadidevicerestore-231e33d5544722d27d08261275332072769e59bc.tar.gz
idevicerestore-231e33d5544722d27d08261275332072769e59bc.tar.bz2
USB: Send a ZLP after mode switches to hopefully increase stability
Sometimes devices do not switch modes, sending a zero length packet appears to fix this situation and prevents failures during restore.
-rw-r--r--src/dfu.c4
-rw-r--r--src/recovery.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/src/dfu.c b/src/dfu.c
index a016c9d..d692608 100644
--- a/src/dfu.c
+++ b/src/dfu.c
@@ -250,6 +250,8 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide
return -1;
}
+ irecv_control_transfer(client->dfu->client, 0x21, 1, 0, 0, 0, 0, 5000);
+
dfu_error = irecv_reset(client->dfu->client);
if (dfu_error != IRECV_E_SUCCESS) {
error("ERROR: Unable to reset device\n");
@@ -315,6 +317,8 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide
return -1;
}
+ irecv_control_transfer(client->dfu->client, 0x21, 1, 0, 0, 0, 0, 5000);
+
dfu_error = irecv_reset(client->dfu->client);
if (dfu_error != IRECV_E_SUCCESS) {
error("ERROR: Unable to reset device\n");
diff --git a/src/recovery.c b/src/recovery.c
index 5b24e31..fc04b1a 100644
--- a/src/recovery.c
+++ b/src/recovery.c
@@ -298,6 +298,7 @@ int recovery_send_ibec(struct idevicerestore_client_t* client, plist_t build_ide
error("ERROR: Unable to execute %s\n", component);
return -1;
}
+ irecv_control_transfer(client->recovery->client, 0x21, 1, 0, 0, 0, 0, 5000);
return 0;
}
@@ -413,6 +414,8 @@ int recovery_send_kernelcache(struct idevicerestore_client_t* client, plist_t bu
return -1;
}
+ irecv_control_transfer(client->recovery->client, 0x21, 1, 0, 0, 0, 0, 5000);
+
return 0;
}