summaryrefslogtreecommitdiffstats
path: root/src/restore.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2016-06-26 18:30:04 +0200
committerGravatar Nikias Bassen2016-06-26 18:30:04 +0200
commit3e8651102df3a694c8e88a73b8d8d753f8d760c6 (patch)
tree0b39ea661fb162c036cf2418b8e74124a57b1fdf /src/restore.c
parentab7af5c54f7294a59b6be267d2be54469a26b778 (diff)
downloadidevicerestore-3e8651102df3a694c8e88a73b8d8d753f8d760c6.tar.gz
idevicerestore-3e8651102df3a694c8e88a73b8d8d753f8d760c6.tar.bz2
restore: Fix restore mode status/progress messages
Diffstat (limited to 'src/restore.c')
-rw-r--r--src/restore.c198
1 files changed, 135 insertions, 63 deletions
diff --git a/src/restore.c b/src/restore.c
index 8200292..5c4a30b 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -39,25 +39,50 @@
#include "restore.h"
#include "common.h"
-#define WAIT_FOR_STORAGE 11
-#define CREATE_PARTITION_MAP 12
-#define CREATE_FILESYSTEM 13
-#define RESTORE_IMAGE 14
-#define VERIFY_RESTORE 15
-#define CHECK_FILESYSTEM 16
-#define MOUNT_FILESYSTEM 17
-#define FLASH_NOR 19
-#define UPDATE_BASEBAND 20
-#define FINIALIZE_NAND 21
-#define MODIFY_BOOTARGS 26
-#define LOAD_KERNEL_CACHE 27
-#define PARTITION_NAND_DEVICE 28
-#define WAIT_FOR_NAND 29
-#define UNMOUNT_FILESYSTEM 30
-#define WAIT_FOR_DEVICE 33
-#define LOAD_NOR 36
-
-#define CREATE_SYSTEM_KEY_BAG 49
+#define CREATE_PARTITION_MAP 11
+#define CREATE_FILESYSTEM 12
+#define RESTORE_IMAGE 13
+#define VERIFY_RESTORE 14
+#define CHECK_FILESYSTEMS 15
+#define MOUNT_FILESYSTEMS 16
+#define FIXUP_VAR 17
+#define FLASH_FIRMWARE 18
+#define UPDATE_BASEBAND 19
+#define SET_BOOT_STAGE 20
+#define REBOOT_DEVICE 21
+#define SHUTDOWN_DEVICE 22
+#define TURN_ON_ACCESSORY_POWER 23
+#define CLEAR_BOOTARGS 24
+#define MODIFY_BOOTARGS 25
+#define INSTALL_ROOT 26
+#define INSTALL_KERNELCACHE 27
+#define WAIT_FOR_NAND 28
+#define UNMOUNT_FILESYSTEMS 29
+#define SET_DATETIME 30
+#define EXEC_IBOOT 31
+#define FINALIZE_NAND_EPOCH_UPDATE 32
+#define CHECK_INAPPR_BOOT_PARTITIONS 33
+#define CREATE_FACTORY_RESTORE_MARKER 34
+#define LOAD_FIRMWARE 35
+#define CHECK_BATTERY_VOLTAGE 38
+#define WAIT_BATTERY_CHARGE 39
+#define CLOSE_MODEM_TICKETS 40
+#define MIGRATE_DATA 41
+#define WIPE_STORAGE_DEVICE 42
+#define SEND_APPLE_LOGO 43
+#define CHECK_LOGS 44
+#define CLEAR_NVRAM 46
+#define UPDATE_GAS_GAUGE 47
+#define PREPARE_BASEBAND_UPDATE 48
+#define BOOT_BASEBAND 49
+#define CREATE_SYSTEM_KEYBAG 50
+#define UPDATE_IR_MCU_FIRMWARE 51
+#define RESIZE_SYSTEM_PARTITION 52
+#define PAIR_STOCKHOLM 54
+#define UPDATE_STOCKHOLM 55
+#define UPDATE_SWDHID 56
+#define UPDATE_S3E_FIRMWARE 58
+#define UPDATE_SE_FIRMWARE 59
static int restore_finished = 0;
@@ -446,59 +471,97 @@ int restore_open_with_timeout(struct idevicerestore_client_t* client) {
return 0;
}
-const char* restore_progress_string(unsigned int operation) {
+const char* restore_progress_string(unsigned int operation)
+{
switch (operation) {
- case WAIT_FOR_STORAGE:
- return "Waiting for storage device";
-
case CREATE_PARTITION_MAP:
return "Creating partition map";
-
case CREATE_FILESYSTEM:
return "Creating filesystem";
-
case RESTORE_IMAGE:
return "Restoring image";
-
case VERIFY_RESTORE:
return "Verifying restore";
-
- case CHECK_FILESYSTEM:
+ case CHECK_FILESYSTEMS:
return "Checking filesystems";
-
- case MOUNT_FILESYSTEM:
+ case MOUNT_FILESYSTEMS:
return "Mounting filesystems";
-
- case FLASH_NOR:
- return "Flashing NOR";
-
+ case FIXUP_VAR:
+ return "Fixing up /var";
+ case FLASH_FIRMWARE:
+ return "Flashing firmware";
case UPDATE_BASEBAND:
return "Updating baseband";
-
- case FINIALIZE_NAND:
- return "Finalizing NAND epoch update";
-
+ case SET_BOOT_STAGE:
+ return "Setting boot stage";
+ case REBOOT_DEVICE:
+ return "Rebooting device";
+ case SHUTDOWN_DEVICE:
+ return "Shutdown device";
+ case TURN_ON_ACCESSORY_POWER:
+ return "Turning on accessory power";
+ case CLEAR_BOOTARGS:
+ return "Clearing persistent boot-args";
case MODIFY_BOOTARGS:
return "Modifying persistent boot-args";
-
- case UNMOUNT_FILESYSTEM:
- return "Unmounting filesystems";
-
- case PARTITION_NAND_DEVICE:
- return "Partition NAND device";
-
+ case INSTALL_ROOT:
+ return "Installing root";
+ case INSTALL_KERNELCACHE:
+ return "Installing kernelcache";
case WAIT_FOR_NAND:
return "Waiting for NAND";
-
- case WAIT_FOR_DEVICE:
- return "Waiting for device";
-
- case LOAD_KERNEL_CACHE:
- return "Loading kernelcache";
-
- case LOAD_NOR:
- return "Loading NOR data to flash";
-
+ case UNMOUNT_FILESYSTEMS:
+ return "Unmounting filesystems";
+ case SET_DATETIME:
+ return "Setting date and time on device";
+ case EXEC_IBOOT:
+ return "Executing iBEC to bootstrap update";
+ case FINALIZE_NAND_EPOCH_UPDATE:
+ return "Finalizing NAND epoch update";
+ case CHECK_INAPPR_BOOT_PARTITIONS:
+ return "Checking for inappropriate bootable partitions";
+ case CREATE_FACTORY_RESTORE_MARKER:
+ return "Creating factory restore marker";
+ case LOAD_FIRMWARE:
+ return "Loading firmware data to flash";
+ case CHECK_BATTERY_VOLTAGE:
+ return "Checking battery voltage";
+ case WAIT_BATTERY_CHARGE:
+ return "Waiting for battery to charge";
+ case CLOSE_MODEM_TICKETS:
+ return "Closing modem tickets";
+ case MIGRATE_DATA:
+ return "Migrating data";
+ case WIPE_STORAGE_DEVICE:
+ return "Wiping storage device";
+ case SEND_APPLE_LOGO:
+ return "Sending Apple logo to device";
+ case CHECK_LOGS:
+ return "Checking for uncollected logs";
+ case CLEAR_NVRAM:
+ return "Clearing NVRAM";
+ case UPDATE_GAS_GAUGE:
+ return "Updating gas gauge software";
+ case PREPARE_BASEBAND_UPDATE:
+ return "Preparing for baseband update";
+ case BOOT_BASEBAND:
+ return "Booting the baseband";
+ case CREATE_SYSTEM_KEYBAG:
+ return "Creating system key bag";
+ case UPDATE_IR_MCU_FIRMWARE:
+ return "Updating IR MCU firmware";
+ case RESIZE_SYSTEM_PARTITION:
+ return "Resizing system partition";
+ case PAIR_STOCKHOLM:
+ return "Pairing Stockholm";
+ case UPDATE_STOCKHOLM:
+ return "Updating Stockholm";
+ case UPDATE_SWDHID:
+ return "Updating SWDHID";
+ case UPDATE_S3E_FIRMWARE:
+ return "Updating S3E Firmware";
+ case UPDATE_SE_FIRMWARE:
+ return "Updating SE Firmware";
default:
return "Unknown operation";
}
@@ -542,26 +605,35 @@ int restore_handle_progress_msg(struct idevicerestore_client_t* client, plist_t
}
plist_get_uint_val(node, &progress);
+ /* for restore protocol version < 14 all operation codes > 35 are 1 less so we add one */
+ int adapted_operation = (int)operation;
+ if (client && client->restore && client->restore->protocol_version < 14) {
+ if (adapted_operation > 35) {
+ adapted_operation++;
+ }
+ }
+
if ((progress > 0) && (progress <= 100)) {
if ((int)operation != lastop) {
- info("%s (%d)\n", restore_progress_string(operation), (int)operation);
+ info("%s (%d)\n", restore_progress_string(adapted_operation), (int)operation);
}
- switch ((int)operation) {
- case 14:
- idevicerestore_progress(client, RESTORE_STEP_FLASH_FS, progress / 100.0);
+ switch (adapted_operation) {
+ case VERIFY_RESTORE:
+ idevicerestore_progress(client, RESTORE_STEP_VERIFY_FS, progress / 100.0);
break;
- case 18:
+ case FLASH_FIRMWARE:
idevicerestore_progress(client, RESTORE_STEP_FLASH_FW, progress / 100.0);
break;
- case 19:
+ case UPDATE_BASEBAND:
+ case UPDATE_IR_MCU_FIRMWARE:
idevicerestore_progress(client, RESTORE_STEP_FLASH_BB, progress / 100.0);
break;
default:
- debug("Unhandled progress operation %d\n", (int)operation);
+ debug("Unhandled progress operation %d (%d)\n", adapted_operation, (int)operation);
break;
}
} else {
- info("%s (%d)\n", restore_progress_string(operation), (int)operation);
+ info("%s (%d)\n", restore_progress_string(adapted_operation), (int)operation);
}
lastop = (int)operation;