summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-01-09 15:32:15 +0100
committerGravatar Martin Szulecki2013-01-09 15:32:15 +0100
commit3de0951516e462d8d438db4a0c3099c5ef308192 (patch)
tree88716639bd4da4d185d5c4011ae513af2d43d9f8 /include
parent21ba76975546cbe1f95ea9c0fe98a9fd2adec35a (diff)
downloadlibirecovery-3de0951516e462d8d438db4a0c3099c5ef308192.tar.gz
libirecovery-3de0951516e462d8d438db4a0c3099c5ef308192.tar.bz2
Improve maintainability of devices and add support for all current models
This removes all CPID_* and BDID_* defines which appear useless as the same information is already stored in the irecv_devices[] struct. Furthermore this removes a big inefficient switch() to determine a device in favor of a simple loop on the irecv_devices[] struct. Overall this means much less maintainance to add new device models in the future.
Diffstat (limited to 'include')
-rw-r--r--include/libirecovery.h167
1 files changed, 63 insertions, 104 deletions
diff --git a/include/libirecovery.h b/include/libirecovery.h
index e7cd30d..fb18ce1 100644
--- a/include/libirecovery.h
+++ b/include/libirecovery.h
@@ -38,86 +38,8 @@ extern "C" {
#endif
#define APPLE_VENDOR_ID 0x05AC
-
-#define CPID_UNKNOWN -1
-#define CPID_IPHONE2G 0x8900
-#define CPID_IPOD1G 0x8900
-#define CPID_IPHONE3G 0x8900
-#define CPID_IPOD2G 0x8720
-#define CPID_IPHONE3GS 0x8920
-#define CPID_IPOD3G 0x8922
-#define CPID_IPAD1G 0x8930
-#define CPID_IPHONE4 0x8930
-#define CPID_IPOD4G 0x8930
-#define CPID_APPLETV2 0x8930
-#define CPID_IPHONE42 0x8930
-#define CPID_IPAD21 0x8940
-#define CPID_IPAD22 0x8940
-#define CPID_IPAD23 0x8940
-#define CPID_IPHONE4S 0x8940
-#define CPID_APPLETV31 0x8942
-#define CPID_IPAD24 0x8942
-#define CPID_IPAD25 0x8942
-#define CPID_IPOD5G 0x8942
-#define CPID_IPAD31 0x8945
-#define CPID_IPAD32 0x8945
-#define CPID_IPAD33 0x8945
-#define CPID_IPHONE5 0x8950
-#define CPID_IPAD34 0x8955
-
-#define BDID_UNKNOWN -1
-#define BDID_IPHONE2G 0x00
-#define BDID_IPOD1G 0x02
-#define BDID_IPHONE3G 0x04
-#define BDID_IPOD2G 0x00
-#define BDID_IPHONE3GS 0x00
-#define BDID_IPOD3G 0x02
-#define BDID_IPAD1G 0x02
-#define BDID_IPHONE4 0x00
-#define BDID_IPOD4G 0x08
-#define BDID_APPLETV2 0x10
-#define BDID_IPHONE42 0x06
-#define BDID_IPAD21 0x04
-#define BDID_IPAD22 0x06
-#define BDID_IPAD23 0x02
-#define BDID_IPHONE4S 0x08
-#define BDID_APPLETV31 0x08
-#define BDID_IPAD24 0x06
-#define BDID_IPAD25 0x0a
-#define BDID_IPOD5G 0x00
-#define BDID_IPAD31 0x00
-#define BDID_IPAD32 0x02
-#define BDID_IPAD33 0x04
-#define BDID_IPHONE51 0x00
-#define BDID_IPHONE52 0x02
-#define BDID_IPAD34 0x00
-
-#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 DEVICE_APPLETV31 15
-#define DEVICE_IPAD24 16
-#define DEVICE_IPAD31 17
-#define DEVICE_IPAD32 18
-#define DEVICE_IPAD33 19
-#define DEVICE_IPHONE51 20
-#define DEVICE_IPHONE52 21
-#define DEVICE_IPOD5G 22
-#define DEVICE_IPAD25 23
-#define DEVICE_IPAD34 24
+#define CPID_UNKNOWN -1
+#define BDID_UNKNOWN -1
enum {
kRecoveryMode1 = 0x1280,
@@ -191,6 +113,38 @@ struct irecv_client {
irecv_event_cb_t disconnected_callback;
};
+#define DEVICE_UNKNOWN -1
+#define DEVICE_IPHONE2G 0
+#define DEVICE_IPHONE3G 1
+#define DEVICE_IPHONE3GS 2
+#define DEVICE_IPHONE4 3
+#define DEVICE_IPHONE4REVA 4
+#define DEVICE_IPHONE4CDMA 5
+#define DEVICE_IPHONE4S 6
+#define DEVICE_IPHONE51 7
+#define DEVICE_IPHONE52 8
+#define DEVICE_IPOD1G 9
+#define DEVICE_IPOD2G 10
+#define DEVICE_IPOD3G 11
+#define DEVICE_IPOD4G 12
+#define DEVICE_IPOD5G 13
+#define DEVICE_IPAD1G 14
+#define DEVICE_IPAD21 15
+#define DEVICE_IPAD22 16
+#define DEVICE_IPAD23 17
+#define DEVICE_IPAD24 18
+#define DEVICE_IPAD25 19
+#define DEVICE_IPAD26 20
+#define DEVICE_IPAD27 21
+#define DEVICE_IPAD31 22
+#define DEVICE_IPAD32 23
+#define DEVICE_IPAD33 24
+#define DEVICE_IPAD34 25
+#define DEVICE_IPAD35 26
+#define DEVICE_IPAD36 27
+#define DEVICE_APPLETV2 28
+#define DEVICE_APPLETV31 29
+
struct irecv_device {
int index;
const char* product;
@@ -201,30 +155,35 @@ struct irecv_device {
static struct irecv_device irecv_devices[] = {
{ 0, "iPhone1,1", "m68ap", 0x00, 0x8900 },
- { 1, "iPod1,1", "n45ap", 0x02, 0x8900 },
- { 2, "iPhone1,2", "n82ap", 0x04, 0x8900 },
- { 3, "iPod2,1", "n72ap", 0x00, 0x8720 },
- { 4, "iPhone2,1", "n88ap", 0x00, 0x8920 },
- { 5, "iPod3,1", "n18ap", 0x02, 0x8922 },
- { 6, "iPad1,1", "k48ap", 0x02, 0x8930 },
- { 7, "iPhone3,1", "n90ap", 0x00, 0x8930 },
- { 8, "iPod4,1", "n81ap", 0x08, 0x8930 },
- { 9, "AppleTV2,1", "k66ap", 0x10, 0x8930 },
- { 10, "iPhone3,3", "n92ap", 0x06, 0x8930 },
- { 11, "iPad2,1", "k93ap", 0x04, 0x8940 },
- { 12, "iPad2,2", "k94ap", 0x06, 0x8940 },
- { 13, "iPad2,3", "k95ap", 0x02, 0x8940 },
- { 14, "iPhone4,1", "n94ap", 0x08, 0x8940 },
- { 15, "AppleTV3,1", "j33ap", 0x08, 0x8942 },
- { 16, "iPad2,4", "k93aap",0x06, 0x8942 },
- { 17, "iPad3,1", "j1ap", 0x00, 0x8945 },
- { 18, "iPad3,2", "j2ap", 0x02, 0x8945 },
- { 19, "iPad3,3", "j2aap", 0x04, 0x8945 },
- { 20, "iPhone5,1", "n41ap", 0x00, 0x8950 },
- { 21, "iPhone5,2", "n42ap", 0x02, 0x8950 },
- { 22, "iPod5,1", "n78ap", 0x00, 0x8942 },
- { 23, "iPad2,5", "p105ap", 0x0a, 0x8942 },
- { 24, "iPad3,4", "p101ap", 0x00, 0x8955 },
+ { 1, "iPhone1,2", "n82ap", 0x04, 0x8900 },
+ { 2, "iPhone2,1", "n88ap", 0x00, 0x8920 },
+ { 3, "iPhone3,1", "n90ap", 0x00, 0x8930 },
+ { 4, "iPhone3,2", "n90bap", 0x04, 0x8930 },
+ { 5, "iPhone3,3", "n92ap", 0x06, 0x8930 },
+ { 6, "iPhone4,1", "n94ap", 0x08, 0x8940 },
+ { 7, "iPhone5,1", "n41ap", 0x00, 0x8950 },
+ { 8, "iPhone5,2", "n42ap", 0x02, 0x8950 },
+ { 9, "iPod1,1", "n45ap", 0x02, 0x8900 },
+ { 10, "iPod2,1", "n72ap", 0x00, 0x8720 },
+ { 11, "iPod3,1", "n18ap", 0x02, 0x8922 },
+ { 12, "iPod4,1", "n81ap", 0x08, 0x8930 },
+ { 13, "iPod5,1", "n78ap", 0x00, 0x8942 },
+ { 14, "iPad1,1", "k48ap", 0x02, 0x8930 },
+ { 15, "iPad2,1", "k93ap", 0x04, 0x8940 },
+ { 16, "iPad2,2", "k94ap", 0x06, 0x8940 },
+ { 17, "iPad2,3", "k95ap", 0x02, 0x8940 },
+ { 18, "iPad2,4", "k93aap", 0x06, 0x8942 },
+ { 19, "iPad2,5", "p105ap", 0x0a, 0x8942 },
+ { 20, "iPad2,6", "p106ap", 0x0c, 0x8942 },
+ { 21, "iPad2,7", "p107ap", 0x0e, 0x8942 },
+ { 22, "iPad3,1", "j1ap", 0x00, 0x8945 },
+ { 23, "iPad3,2", "j2ap", 0x02, 0x8945 },
+ { 24, "iPad3,3", "j2aap", 0x04, 0x8945 },
+ { 25, "iPad3,4", "p101ap", 0x00, 0x8955 },
+ { 26, "iPad3,5", "p102ap", 0x02, 0x8955 },
+ { 27, "iPad3,6", "p103ap", 0x04, 0x8955 },
+ { 28, "AppleTV2,1", "k66ap", 0x10, 0x8930 },
+ { 29, "AppleTV3,1", "j33ap", 0x08, 0x8942 },
{ -1, NULL, NULL, -1, -1 }
};