summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-11-20 17:00:35 +0100
committerGravatar Martin Szulecki2013-11-20 17:04:04 +0100
commit76e3f71c1aa7d54b2653073a32ae42c8088ca72a (patch)
tree486f3097375185a8638c2f06728d97059be4b75c
parent3c04e82be9af10e8b9b45a3d7138a67c7b04a616 (diff)
downloadidevicerestore-76e3f71c1aa7d54b2653073a32ae42c8088ca72a.tar.gz
idevicerestore-76e3f71c1aa7d54b2653073a32ae42c8088ca72a.tar.bz2
dfu: Implement dfu_get_ecid() to fix connectivity issues from DFU mode
-rw-r--r--src/dfu.c19
-rw-r--r--src/dfu.h1
-rw-r--r--src/idevicerestore.c6
3 files changed, 26 insertions, 0 deletions
diff --git a/src/dfu.c b/src/dfu.c
index c580c72..3bdd419 100644
--- a/src/dfu.c
+++ b/src/dfu.c
@@ -253,6 +253,25 @@ int dfu_get_cpid(struct idevicerestore_client_t* client, unsigned int* cpid) {
return 0;
}
+int dfu_get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid) {
+ irecv_error_t recovery_error = IRECV_E_SUCCESS;
+
+ if(client->dfu == NULL) {
+ if (dfu_client_new(client) < 0) {
+ return -1;
+ }
+ }
+
+ const struct irecv_device_info *device_info = irecv_get_device_info(client->dfu->client);
+ if (!device_info) {
+ return -1;
+ }
+
+ *ecid = device_info->ecid;
+
+ return 0;
+}
+
int dfu_is_image4_supported(struct idevicerestore_client_t* client)
{
if(client->dfu == NULL) {
diff --git a/src/dfu.h b/src/dfu.h
index 427754a..1d297bb 100644
--- a/src/dfu.h
+++ b/src/dfu.h
@@ -44,6 +44,7 @@ const char* dfu_check_product_type(struct idevicerestore_client_t* client);
int dfu_send_buffer(struct idevicerestore_client_t* client, unsigned char* buffer, unsigned int size);
int dfu_send_component(struct idevicerestore_client_t* client, plist_t build_identity, const char* component);
int dfu_get_cpid(struct idevicerestore_client_t* client, unsigned int* cpid);
+int dfu_get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid);
int dfu_is_image4_supported(struct idevicerestore_client_t* client);
int dfu_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
int dfu_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index dcd538e..d1db628 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -754,6 +754,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
// if the device is in DFU mode, place device into recovery mode
if (client->mode->index == MODE_DFU) {
+ dfu_client_free(client);
recovery_client_free(client);
if ((client->flags & FLAG_CUSTOM) && limera1n_is_supported(client->device)) {
info("connecting to DFU\n");
@@ -1225,6 +1226,11 @@ int get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid) {
break;
case MODE_DFU:
+ if (dfu_get_ecid(client, ecid) < 0) {
+ *ecid = 0;
+ return -1;
+ }
+ break;
case MODE_RECOVERY:
if (recovery_get_ecid(client, ecid) < 0) {
*ecid = 0;