diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/recovery.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/src/recovery.c b/src/recovery.c index 3eec1a3..cf38b16 100644 --- a/src/recovery.c +++ b/src/recovery.c @@ -123,11 +123,34 @@ int recovery_check_mode() { return 0; } +static int recovery_enable_autoboot(struct idevicerestore_client_t* client) { + irecv_error_t recovery_error = IRECV_E_SUCCESS; + + recovery_error = irecv_setenv(client->recovery->client, "auto-boot", "true"); + if (recovery_error != IRECV_E_SUCCESS) { + error("ERROR: Unable to set auto-boot environmental variable\n"); + return -1; + } + + recovery_error = irecv_send_command(client->recovery->client, "saveenv"); + if (recovery_error != IRECV_E_SUCCESS) { + error("ERROR: Unable to save environmental variable\n"); + return -1; + } + + return 0; +} + int recovery_enter_restore(struct idevicerestore_client_t* client, plist_t build_identity) { idevice_t device = NULL; restored_client_t restore = NULL; - // upload data to make device boot restore mode + /* upload data to make device boot restore mode */ + + if (recovery_enable_autoboot(client) < 0) { + return -1; + } + if (recovery_send_ibec(client, build_identity) < 0) { error("ERROR: Unable to send iBEC\n"); return -1; @@ -221,32 +244,10 @@ int recovery_send_component(struct idevicerestore_client_t* client, plist_t buil return 0; } -static int recovery_enable_autoboot(struct idevicerestore_client_t* client) { - irecv_error_t recovery_error = IRECV_E_SUCCESS; - //recovery_error = irecv_send_command(client->recovery->client, "setenv auto-boot true"); - recovery_error = irecv_setenv(client->recovery->client, "auto-boot", "true"); - if (recovery_error != IRECV_E_SUCCESS) { - error("ERROR: Unable to set auto-boot environmental variable\n"); - return -1; - } - - recovery_error = irecv_send_command(client->recovery->client, "saveenv"); - if (recovery_error != IRECV_E_SUCCESS) { - error("ERROR: Unable to save environmental variable\n"); - return -1; - } - - return 0; -} - int recovery_send_ibec(struct idevicerestore_client_t* client, plist_t build_identity) { const char* component = "iBEC"; irecv_error_t recovery_error = IRECV_E_SUCCESS; - if (recovery_enable_autoboot(client) < 0) { - return -1; - } - if (recovery_send_component(client, build_identity, component) < 0) { error("ERROR: Unable to send %s to device.\n", component); return -1; |