summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/common.h5
-rw-r--r--src/idevicerestore.c4
-rw-r--r--src/recovery.c9
3 files changed, 15 insertions, 3 deletions
diff --git a/src/common.h b/src/common.h
index 50f682f..f8c0ae0 100644
--- a/src/common.h
+++ b/src/common.h
@@ -40,6 +40,7 @@ extern "C" {
#define CPID_IPHONE3GS 8920
#define CPID_IPOD3G 8922
#define CPID_IPAD1G 8930
+#define CPID_IPHONE4 8930
#define BDID_UNKNOWN -1
#define BDID_IPHONE2G 0
@@ -49,6 +50,7 @@ extern "C" {
#define BDID_IPHONE3GS 0
#define BDID_IPOD3G 2
#define BDID_IPAD1G 2
+#define BDID_IPHONE4 0
#define DEVICE_UNKNOWN -1
#define DEVICE_IPHONE2G 0
@@ -58,6 +60,7 @@ extern "C" {
#define DEVICE_IPHONE3GS 4
#define DEVICE_IPOD3G 5
#define DEVICE_IPAD1G 6
+#define DEVICE_IPHONE4 7
#define MODE_UNKNOWN -1
#define MODE_DFU 0
@@ -131,7 +134,7 @@ static struct idevicerestore_device_t idevicerestore_devices[] = {
{ 4, "iPhone2,1", "N88AP", 0, 8920 },
{ 5, "iPod3,1", "N18AP", 2, 8922 },
{ 6, "iPad1,1", "K48AP", 2, 8930 },
- { 6, "iPhone3,1", "XXXAP", 0, 0 },
+ { 7, "iPhone3,1", "N90AP", 0, 8930 },
{ -1, NULL, NULL, -1, -1 }
};
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 3e346fc..456d290 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -417,7 +417,7 @@ int get_bdid(struct idevicerestore_client_t* client, uint32_t* bdid) {
int get_cpid(struct idevicerestore_client_t* client, uint32_t* cpid) {
switch (client->mode->index) {
case MODE_NORMAL:
- if (normal_get_cpid(client->uuid, &client->device->chip_id) < 0) {
+ if (normal_get_cpid(client->uuid, cpid) < 0) {
client->device->chip_id = -1;
return -1;
}
@@ -425,7 +425,7 @@ int get_cpid(struct idevicerestore_client_t* client, uint32_t* cpid) {
case MODE_DFU:
case MODE_RECOVERY:
- if (recovery_get_cpid(client, &client->device->chip_id) < 0) {
+ if (recovery_get_cpid(client, cpid) < 0) {
client->device->chip_id = -1;
return -1;
}
diff --git a/src/recovery.c b/src/recovery.c
index 290f368..fbcc49c 100644
--- a/src/recovery.c
+++ b/src/recovery.c
@@ -45,6 +45,7 @@ int recovery_client_new(struct idevicerestore_client_t* client) {
error("ERROR: Out of memory\n");
return -1;
}
+ client->recovery = recovery;
if (recovery_open_with_timeout(client) < 0) {
recovery_client_free(client);
@@ -74,6 +75,14 @@ int recovery_open_with_timeout(struct idevicerestore_client_t* client) {
irecv_client_t recovery = NULL;
irecv_error_t recovery_error = IRECV_E_UNKNOWN_ERROR;
+ if(client->recovery == NULL) {
+ if(recovery_client_new(client) < 0) {
+ error("ERROR: Unable to open device in recovery mode\n");
+ return -1;
+ }
+ return 0;
+ }
+
for (i = 1; i <= attempts; i++) {
recovery_error = irecv_open(&recovery);
if (recovery_error == IRECV_E_SUCCESS) {