From d7f8d0e0824d2213fb9811e9340586d1c704851b Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 14 Feb 2012 21:17:23 +0100 Subject: remove duplicate CPID/BDID and devices structs and use the ones from libirecovery.h instead --- src/common.h | 82 ++-------------------------------------------------- src/idevicerestore.c | 2 +- src/limera1n.c | 2 +- src/limera1n.h | 2 +- src/normal.c | 6 ++-- src/restore.c | 6 ++-- 6 files changed, 12 insertions(+), 88 deletions(-) diff --git a/src/common.h b/src/common.h index 1ffe3bd..c30f98f 100644 --- a/src/common.h +++ b/src/common.h @@ -28,61 +28,12 @@ extern "C" { #include +#include "libirecovery.h" + #define info(...) printf(__VA_ARGS__) #define error(...) fprintf(stderr, __VA_ARGS__) #define debug(...) if(idevicerestore_debug) fprintf(stderr, __VA_ARGS__) -#define CPID_UNKNOWN -1 -#define CPID_IPHONE2G 8900 -#define CPID_IPOD1G 8900 -#define CPID_IPHONE3G 8900 -#define CPID_IPOD2G 8720 -#define CPID_IPHONE3GS 8920 -#define CPID_IPOD3G 8922 -#define CPID_IPAD1G 8930 -#define CPID_IPHONE4 8930 -#define CPID_IPOD4G 8930 -#define CPID_APPLETV2 8930 -#define CPID_IPHONE42 8930 -#define CPID_IPAD21 8940 -#define CPID_IPAD22 8940 -#define CPID_IPAD23 8940 -#define CPID_IPHONE4S 8940 - -#define BDID_UNKNOWN -1 -#define BDID_IPHONE2G 0 -#define BDID_IPOD1G 2 -#define BDID_IPHONE3G 4 -#define BDID_IPOD2G 0 -#define BDID_IPHONE3GS 0 -#define BDID_IPOD3G 2 -#define BDID_IPAD1G 2 -#define BDID_IPHONE4 0 -#define BDID_IPOD4G 8 -#define BDID_APPLETV2 10 -#define BDID_IPHONE42 6 -#define BDID_IPAD21 4 -#define BDID_IPAD22 6 -#define BDID_IPAD23 2 -#define BDID_IPHONE4S 8 - -#define DEVICE_UNKNOWN -1 -#define DEVICE_IPHONE2G 0 -#define DEVICE_IPOD1G 1 -#define DEVICE_IPHONE3G 2 -#define DEVICE_IPOD2G 3 -#define DEVICE_IPHONE3GS 4 -#define DEVICE_IPOD3G 5 -#define DEVICE_IPAD1G 6 -#define DEVICE_IPHONE4 7 -#define DEVICE_IPOD4G 8 -#define DEVICE_APPLETV2 9 -#define DEVICE_IPHONE42 10 -#define DEVICE_IPAD21 11 -#define DEVICE_IPAD22 12 -#define DEVICE_IPAD23 13 -#define DEVICE_IPHONE4S 14 - #define MODE_UNKNOWN -1 #define MODE_WTF 0 #define MODE_DFU 1 @@ -119,14 +70,6 @@ struct idevicerestore_entry_t { struct idevicerestore_entry* prev; }; -struct idevicerestore_device_t { - int index; - const char* product; - const char* model; - uint32_t board_id; - uint32_t chip_id; -}; - struct idevicerestore_client_t { int flags; plist_t tss; @@ -142,7 +85,7 @@ struct idevicerestore_client_t { struct normal_client_t* normal; struct restore_client_t* restore; struct recovery_client_t* recovery; - struct idevicerestore_device_t* device; + struct irecv_device* device; struct idevicerestore_entry_t** entries; struct idevicerestore_mode_t* mode; char* version; @@ -159,25 +102,6 @@ static struct idevicerestore_mode_t idevicerestore_modes[] = { { -1, NULL } }; -static struct idevicerestore_device_t idevicerestore_devices[] = { - { 0, "iPhone1,1", "M68AP", 0, 8900 }, - { 1, "iPod1,1", "N45AP", 2, 8900 }, - { 2, "iPhone1,2", "N82AP", 4, 8900 }, - { 3, "iPod2,1", "N72AP", 0, 8720 }, - { 4, "iPhone2,1", "N88AP", 0, 8920 }, - { 5, "iPod3,1", "N18AP", 2, 8922 }, - { 6, "iPad1,1", "K48AP", 2, 8930 }, - { 7, "iPhone3,1", "N90AP", 0, 8930 }, - { 8, "iPod4,1", "N81AP", 8, 8930 }, - { 9, "AppleTV2,1", "K66AP", 10, 8930 }, - { 10, "iPhone3,3", "N92AP", 6, 8930 }, - { 11, "iPad2,1", "K93AP", 4, 8940 }, - { 12, "iPad2,2", "K94AP", 6, 8940 }, - { 13, "iPad2,3", "K95AP", 2, 8940 }, - { 14, "iPhone4,1", "N94AP", 8, 8940 }, - { -1, NULL, NULL, -1, -1 } -}; - extern int idevicerestore_debug; void debug_plist(plist_t plist); diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 72b2359..971f81d 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -904,7 +904,7 @@ int check_device(struct idevicerestore_client_t* client) { } - client->device = &idevicerestore_devices[device]; + client->device = &irecv_devices[device]; return device; } diff --git a/src/limera1n.c b/src/limera1n.c index 309b361..fa5042e 100644 --- a/src/limera1n.c +++ b/src/limera1n.c @@ -28,7 +28,7 @@ #include "limera1n_payload.h" #include "libirecovery.h" -int limera1n_exploit(struct idevicerestore_device_t *device, irecv_client_t client) +int limera1n_exploit(struct irecv_device *device, irecv_client_t client) { irecv_error_t error = IRECV_E_SUCCESS; unsigned int i = 0; diff --git a/src/limera1n.h b/src/limera1n.h index ed2339a..0de6173 100644 --- a/src/limera1n.h +++ b/src/limera1n.h @@ -2,6 +2,6 @@ #define __LIMERA1N_H #include "libirecovery.h" -int limera1n_exploit(struct idevicerestore_device_t *device, irecv_client_t client); +int limera1n_exploit(struct irecv_device *device, irecv_client_t client); #endif /* __LIMERA1N_H */ diff --git a/src/normal.c b/src/normal.c index 9902597..8547b2c 100644 --- a/src/normal.c +++ b/src/normal.c @@ -248,13 +248,13 @@ int normal_check_device(struct idevicerestore_client_t* client) { plist_get_string_val(product_type_node, &product_type); plist_free(product_type_node); - for (i = 0; idevicerestore_devices[i].product != NULL; i++) { - if (!strcmp(product_type, idevicerestore_devices[i].product)) { + for (i = 0; irecv_devices[i].product != NULL; i++) { + if (!strcmp(product_type, irecv_devices[i].product)) { break; } } - return idevicerestore_devices[i].index; + return irecv_devices[i].index; } int normal_enter_recovery(struct idevicerestore_client_t* client) { diff --git a/src/restore.c b/src/restore.c index 4452d46..df39b9d 100644 --- a/src/restore.c +++ b/src/restore.c @@ -169,13 +169,13 @@ int restore_check_device(const char* uuid) { } plist_get_string_val(node, &model); - for (i = 0; idevicerestore_devices[i].model != NULL; i++) { - if (!strcasecmp(model, idevicerestore_devices[i].model)) { + for (i = 0; irecv_devices[i].model != NULL; i++) { + if (!strcasecmp(model, irecv_devices[i].model)) { break; } } - return idevicerestore_devices[i].index; + return irecv_devices[i].index; } void restore_device_callback(const idevice_event_t* event, void* userdata) { -- cgit v1.1-32-gdbae