summaryrefslogtreecommitdiffstats
path: root/src/recovery.c
diff options
context:
space:
mode:
authorGravatar Joshua Hill2010-06-04 16:02:05 -0400
committerGravatar Joshua Hill2010-06-04 16:02:05 -0400
commit26e7635460c7369be07455a7bcc7621cf53cdd2d (patch)
tree418ddb485d8ad259b207cdb4cdc79b66dc328349 /src/recovery.c
parent95d83e38a95c9cf28ffa59611149fbba242449c4 (diff)
downloadidevicerestore-26e7635460c7369be07455a7bcc7621cf53cdd2d.tar.gz
idevicerestore-26e7635460c7369be07455a7bcc7621cf53cdd2d.tar.bz2
Refactoring continued, lots of bug fixes, probably about half way through
Diffstat (limited to 'src/recovery.c')
-rw-r--r--src/recovery.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/recovery.c b/src/recovery.c
index 9885982..3bfb97e 100644
--- a/src/recovery.c
+++ b/src/recovery.c
@@ -48,6 +48,43 @@ int recovery_check_mode() {
return 0;
}
+int recovery_enter_restore(const char* ipsw, plist_t tss) {
+ // upload data to make device boot restore mode
+ if (recovery_send_ibec(ipsw, tss) < 0) {
+ error("ERROR: Unable to send iBEC\n");
+ return -1;
+ }
+ sleep(1);
+
+ if (recovery_send_applelogo(ipsw, tss) < 0) {
+ error("ERROR: Unable to send AppleLogo\n");
+ return -1;
+ }
+
+ if (recovery_send_devicetree(ipsw, tss) < 0) {
+ error("ERROR: Unable to send DeviceTree\n");
+ return -1;
+ }
+
+ if (recovery_send_ramdisk(ipsw, tss) < 0) {
+ error("ERROR: Unable to send Ramdisk\n");
+ return -1;
+ }
+
+ // for some reason iboot requires a hard reset after ramdisk
+ // or things start getting wacky
+ printf("Please unplug your device, then plug it back in\n");
+ printf("Hit any key to continue...");
+ getchar();
+
+ if (recovery_send_kernelcache(ipsw, tss) < 0) {
+ error("ERROR: Unable to send KernelCache\n");
+ return -1;
+ }
+
+ return 0;
+}
+
int recovery_send_signed_component(irecv_client_t client, const char* ipsw, plist_t tss, char* component) {
int size = 0;
char* data = NULL;
@@ -306,7 +343,7 @@ int recovery_get_cpid(uint32_t* cpid) {
return -1;
}
- irecv_error_t error = irecv_get_ecid(recovery, cpid);
+ irecv_error_t error = irecv_get_cpid(recovery, cpid);
if (error != IRECV_E_SUCCESS) {
irecv_close(recovery);
return -1;
@@ -323,7 +360,7 @@ int recovery_get_bdid(uint32_t* bdid) {
return -1;
}
- irecv_error_t error = irecv_get_ecid(recovery, bdid);
+ irecv_error_t error = irecv_get_bdid(recovery, bdid);
if (error != IRECV_E_SUCCESS) {
irecv_close(recovery);
return -1;