diff options
author | Nikias Bassen | 2019-10-11 00:06:07 +0200 |
---|---|---|
committer | Nikias Bassen | 2019-10-11 00:06:07 +0200 |
commit | 75a61508bd3c2013492744fb5aea755e19b01086 (patch) | |
tree | 8a7a72bd9ea3511a47f5118b6e6ecfedec16a4d0 /src | |
parent | 49a2d7a05633d1d87c51307e31f8d34fbd1f4451 (diff) | |
download | idevicerestore-75a61508bd3c2013492744fb5aea755e19b01086.tar.gz idevicerestore-75a61508bd3c2013492744fb5aea755e19b01086.tar.bz2 |
dfu: Fix DFU loading of iBSS -> iBEC on newer devices
Diffstat (limited to 'src')
-rw-r--r-- | src/dfu.c | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -342,10 +342,10 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide client->dfu->client = NULL; return -1; } + dfu_client_free(client); if (client->build_major > 8) { /* reconnect */ - dfu_client_free(client); debug("Waiting for device to disconnect...\n"); WAIT_FOR(client->mode == &idevicerestore_modes[MODE_UNKNOWN] || (client->flags & FLAG_QUIT), 10); if (client->mode != &idevicerestore_modes[MODE_UNKNOWN] || (client->flags & FLAG_QUIT)) { @@ -354,11 +354,11 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide } return -1; } - debug("Waiting for device to reconnect in DFU mode...\n"); - WAIT_FOR(client->mode == &idevicerestore_modes[MODE_DFU] || (client->flags & FLAG_QUIT), 10); - if (client->mode != &idevicerestore_modes[MODE_DFU] || (client->flags & FLAG_QUIT)) { + debug("Waiting for device to reconnect...\n"); + WAIT_FOR(client->mode == &idevicerestore_modes[MODE_DFU] || client->mode == &idevicerestore_modes[MODE_RECOVERY] || (client->flags & FLAG_QUIT), 10); + if ((client->mode != &idevicerestore_modes[MODE_DFU] && client->mode != &idevicerestore_modes[MODE_RECOVERY]) || (client->flags & FLAG_QUIT)) { if (!(client->flags & FLAG_QUIT)) { - error("ERROR: Device did not reconnect in DFU mode. Possibly invalid iBSS. Reset device and try again.\n"); + error("ERROR: Device did not reconnect in DFU or recovery mode. Possibly invalid iBSS. Reset device and try again.\n"); } return -1; } @@ -416,8 +416,16 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide client->dfu->client = NULL; return -1; } + + if (client->mode == &idevicerestore_modes[MODE_RECOVERY]) { + if (irecv_send_command(client->dfu->client, "go") != IRECV_E_SUCCESS) { + error("ERROR: Unable to execute iBEC\n"); + return -1; + } + irecv_usb_control_transfer(client->dfu->client, 0x21, 1, 0, 0, 0, 0, 5000); + } + dfu_client_free(client); } - dfu_client_free(client); debug("Waiting for device to disconnect...\n"); WAIT_FOR(client->mode == &idevicerestore_modes[MODE_UNKNOWN] || (client->flags & FLAG_QUIT), 10); |