diff options
| author | 2013-01-09 15:32:15 +0100 | |
|---|---|---|
| committer | 2013-01-09 15:32:15 +0100 | |
| commit | 3de0951516e462d8d438db4a0c3099c5ef308192 (patch) | |
| tree | 88716639bd4da4d185d5c4011ae513af2d43d9f8 /include/libirecovery.h | |
| parent | 21ba76975546cbe1f95ea9c0fe98a9fd2adec35a (diff) | |
| download | libirecovery-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/libirecovery.h')
| -rw-r--r-- | include/libirecovery.h | 167 |
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" { | |||
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #define APPLE_VENDOR_ID 0x05AC | 40 | #define APPLE_VENDOR_ID 0x05AC |
| 41 | 41 | #define CPID_UNKNOWN -1 | |
| 42 | #define CPID_UNKNOWN -1 | 42 | #define BDID_UNKNOWN -1 |
| 43 | #define CPID_IPHONE2G 0x8900 | ||
| 44 | #define CPID_IPOD1G 0x8900 | ||
| 45 | #define CPID_IPHONE3G 0x8900 | ||
| 46 | #define CPID_IPOD2G 0x8720 | ||
| 47 | #define CPID_IPHONE3GS 0x8920 | ||
| 48 | #define CPID_IPOD3G 0x8922 | ||
| 49 | #define CPID_IPAD1G 0x8930 | ||
| 50 | #define CPID_IPHONE4 0x8930 | ||
| 51 | #define CPID_IPOD4G 0x8930 | ||
| 52 | #define CPID_APPLETV2 0x8930 | ||
| 53 | #define CPID_IPHONE42 0x8930 | ||
| 54 | #define CPID_IPAD21 0x8940 | ||
| 55 | #define CPID_IPAD22 0x8940 | ||
| 56 | #define CPID_IPAD23 0x8940 | ||
| 57 | #define CPID_IPHONE4S 0x8940 | ||
| 58 | #define CPID_APPLETV31 0x8942 | ||
| 59 | #define CPID_IPAD24 0x8942 | ||
| 60 | #define CPID_IPAD25 0x8942 | ||
| 61 | #define CPID_IPOD5G 0x8942 | ||
| 62 | #define CPID_IPAD31 0x8945 | ||
| 63 | #define CPID_IPAD32 0x8945 | ||
| 64 | #define CPID_IPAD33 0x8945 | ||
| 65 | #define CPID_IPHONE5 0x8950 | ||
| 66 | #define CPID_IPAD34 0x8955 | ||
| 67 | |||
| 68 | #define BDID_UNKNOWN -1 | ||
| 69 | #define BDID_IPHONE2G 0x00 | ||
| 70 | #define BDID_IPOD1G 0x02 | ||
| 71 | #define BDID_IPHONE3G 0x04 | ||
| 72 | #define BDID_IPOD2G 0x00 | ||
| 73 | #define BDID_IPHONE3GS 0x00 | ||
| 74 | #define BDID_IPOD3G 0x02 | ||
| 75 | #define BDID_IPAD1G 0x02 | ||
| 76 | #define BDID_IPHONE4 0x00 | ||
| 77 | #define BDID_IPOD4G 0x08 | ||
| 78 | #define BDID_APPLETV2 0x10 | ||
| 79 | #define BDID_IPHONE42 0x06 | ||
| 80 | #define BDID_IPAD21 0x04 | ||
| 81 | #define BDID_IPAD22 0x06 | ||
| 82 | #define BDID_IPAD23 0x02 | ||
| 83 | #define BDID_IPHONE4S 0x08 | ||
| 84 | #define BDID_APPLETV31 0x08 | ||
| 85 | #define BDID_IPAD24 0x06 | ||
| 86 | #define BDID_IPAD25 0x0a | ||
| 87 | #define BDID_IPOD5G 0x00 | ||
| 88 | #define BDID_IPAD31 0x00 | ||
| 89 | #define BDID_IPAD32 0x02 | ||
| 90 | #define BDID_IPAD33 0x04 | ||
| 91 | #define BDID_IPHONE51 0x00 | ||
| 92 | #define BDID_IPHONE52 0x02 | ||
| 93 | #define BDID_IPAD34 0x00 | ||
| 94 | |||
| 95 | #define DEVICE_UNKNOWN -1 | ||
| 96 | #define DEVICE_IPHONE2G 0 | ||
| 97 | #define DEVICE_IPOD1G 1 | ||
| 98 | #define DEVICE_IPHONE3G 2 | ||
| 99 | #define DEVICE_IPOD2G 3 | ||
| 100 | #define DEVICE_IPHONE3GS 4 | ||
| 101 | #define DEVICE_IPOD3G 5 | ||
| 102 | #define DEVICE_IPAD1G 6 | ||
| 103 | #define DEVICE_IPHONE4 7 | ||
| 104 | #define DEVICE_IPOD4G 8 | ||
| 105 | #define DEVICE_APPLETV2 9 | ||
| 106 | #define DEVICE_IPHONE42 10 | ||
| 107 | #define DEVICE_IPAD21 11 | ||
| 108 | #define DEVICE_IPAD22 12 | ||
| 109 | #define DEVICE_IPAD23 13 | ||
| 110 | #define DEVICE_IPHONE4S 14 | ||
| 111 | #define DEVICE_APPLETV31 15 | ||
| 112 | #define DEVICE_IPAD24 16 | ||
| 113 | #define DEVICE_IPAD31 17 | ||
| 114 | #define DEVICE_IPAD32 18 | ||
| 115 | #define DEVICE_IPAD33 19 | ||
| 116 | #define DEVICE_IPHONE51 20 | ||
| 117 | #define DEVICE_IPHONE52 21 | ||
| 118 | #define DEVICE_IPOD5G 22 | ||
| 119 | #define DEVICE_IPAD25 23 | ||
| 120 | #define DEVICE_IPAD34 24 | ||
| 121 | 43 | ||
| 122 | enum { | 44 | enum { |
| 123 | kRecoveryMode1 = 0x1280, | 45 | kRecoveryMode1 = 0x1280, |
| @@ -191,6 +113,38 @@ struct irecv_client { | |||
| 191 | irecv_event_cb_t disconnected_callback; | 113 | irecv_event_cb_t disconnected_callback; |
| 192 | }; | 114 | }; |
| 193 | 115 | ||
| 116 | #define DEVICE_UNKNOWN -1 | ||
| 117 | #define DEVICE_IPHONE2G 0 | ||
| 118 | #define DEVICE_IPHONE3G 1 | ||
| 119 | #define DEVICE_IPHONE3GS 2 | ||
| 120 | #define DEVICE_IPHONE4 3 | ||
| 121 | #define DEVICE_IPHONE4REVA 4 | ||
| 122 | #define DEVICE_IPHONE4CDMA 5 | ||
| 123 | #define DEVICE_IPHONE4S 6 | ||
| 124 | #define DEVICE_IPHONE51 7 | ||
| 125 | #define DEVICE_IPHONE52 8 | ||
| 126 | #define DEVICE_IPOD1G 9 | ||
| 127 | #define DEVICE_IPOD2G 10 | ||
| 128 | #define DEVICE_IPOD3G 11 | ||
| 129 | #define DEVICE_IPOD4G 12 | ||
| 130 | #define DEVICE_IPOD5G 13 | ||
| 131 | #define DEVICE_IPAD1G 14 | ||
| 132 | #define DEVICE_IPAD21 15 | ||
| 133 | #define DEVICE_IPAD22 16 | ||
| 134 | #define DEVICE_IPAD23 17 | ||
| 135 | #define DEVICE_IPAD24 18 | ||
| 136 | #define DEVICE_IPAD25 19 | ||
| 137 | #define DEVICE_IPAD26 20 | ||
| 138 | #define DEVICE_IPAD27 21 | ||
| 139 | #define DEVICE_IPAD31 22 | ||
| 140 | #define DEVICE_IPAD32 23 | ||
| 141 | #define DEVICE_IPAD33 24 | ||
| 142 | #define DEVICE_IPAD34 25 | ||
| 143 | #define DEVICE_IPAD35 26 | ||
| 144 | #define DEVICE_IPAD36 27 | ||
| 145 | #define DEVICE_APPLETV2 28 | ||
| 146 | #define DEVICE_APPLETV31 29 | ||
| 147 | |||
| 194 | struct irecv_device { | 148 | struct irecv_device { |
| 195 | int index; | 149 | int index; |
| 196 | const char* product; | 150 | const char* product; |
| @@ -201,30 +155,35 @@ struct irecv_device { | |||
| 201 | 155 | ||
| 202 | static struct irecv_device irecv_devices[] = { | 156 | static struct irecv_device irecv_devices[] = { |
| 203 | { 0, "iPhone1,1", "m68ap", 0x00, 0x8900 }, | 157 | { 0, "iPhone1,1", "m68ap", 0x00, 0x8900 }, |
| 204 | { 1, "iPod1,1", "n45ap", 0x02, 0x8900 }, | 158 | { 1, "iPhone1,2", "n82ap", 0x04, 0x8900 }, |
| 205 | { 2, "iPhone1,2", "n82ap", 0x04, 0x8900 }, | 159 | { 2, "iPhone2,1", "n88ap", 0x00, 0x8920 }, |
| 206 | { 3, "iPod2,1", "n72ap", 0x00, 0x8720 }, | 160 | { 3, "iPhone3,1", "n90ap", 0x00, 0x8930 }, |
| 207 | { 4, "iPhone2,1", "n88ap", 0x00, 0x8920 }, | 161 | { 4, "iPhone3,2", "n90bap", 0x04, 0x8930 }, |
| 208 | { 5, "iPod3,1", "n18ap", 0x02, 0x8922 }, | 162 | { 5, "iPhone3,3", "n92ap", 0x06, 0x8930 }, |
| 209 | { 6, "iPad1,1", "k48ap", 0x02, 0x8930 }, | 163 | { 6, "iPhone4,1", "n94ap", 0x08, 0x8940 }, |
| 210 | { 7, "iPhone3,1", "n90ap", 0x00, 0x8930 }, | 164 | { 7, "iPhone5,1", "n41ap", 0x00, 0x8950 }, |
| 211 | { 8, "iPod4,1", "n81ap", 0x08, 0x8930 }, | 165 | { 8, "iPhone5,2", "n42ap", 0x02, 0x8950 }, |
| 212 | { 9, "AppleTV2,1", "k66ap", 0x10, 0x8930 }, | 166 | { 9, "iPod1,1", "n45ap", 0x02, 0x8900 }, |
| 213 | { 10, "iPhone3,3", "n92ap", 0x06, 0x8930 }, | 167 | { 10, "iPod2,1", "n72ap", 0x00, 0x8720 }, |
| 214 | { 11, "iPad2,1", "k93ap", 0x04, 0x8940 }, | 168 | { 11, "iPod3,1", "n18ap", 0x02, 0x8922 }, |
| 215 | { 12, "iPad2,2", "k94ap", 0x06, 0x8940 }, | 169 | { 12, "iPod4,1", "n81ap", 0x08, 0x8930 }, |
| 216 | { 13, "iPad2,3", "k95ap", 0x02, 0x8940 }, | 170 | { 13, "iPod5,1", "n78ap", 0x00, 0x8942 }, |
| 217 | { 14, "iPhone4,1", "n94ap", 0x08, 0x8940 }, | 171 | { 14, "iPad1,1", "k48ap", 0x02, 0x8930 }, |
| 218 | { 15, "AppleTV3,1", "j33ap", 0x08, 0x8942 }, | 172 | { 15, "iPad2,1", "k93ap", 0x04, 0x8940 }, |
| 219 | { 16, "iPad2,4", "k93aap",0x06, 0x8942 }, | 173 | { 16, "iPad2,2", "k94ap", 0x06, 0x8940 }, |
| 220 | { 17, "iPad3,1", "j1ap", 0x00, 0x8945 }, | 174 | { 17, "iPad2,3", "k95ap", 0x02, 0x8940 }, |
| 221 | { 18, "iPad3,2", "j2ap", 0x02, 0x8945 }, | 175 | { 18, "iPad2,4", "k93aap", 0x06, 0x8942 }, |
| 222 | { 19, "iPad3,3", "j2aap", 0x04, 0x8945 }, | 176 | { 19, "iPad2,5", "p105ap", 0x0a, 0x8942 }, |
| 223 | { 20, "iPhone5,1", "n41ap", 0x00, 0x8950 }, | 177 | { 20, "iPad2,6", "p106ap", 0x0c, 0x8942 }, |
| 224 | { 21, "iPhone5,2", "n42ap", 0x02, 0x8950 }, | 178 | { 21, "iPad2,7", "p107ap", 0x0e, 0x8942 }, |
| 225 | { 22, "iPod5,1", "n78ap", 0x00, 0x8942 }, | 179 | { 22, "iPad3,1", "j1ap", 0x00, 0x8945 }, |
| 226 | { 23, "iPad2,5", "p105ap", 0x0a, 0x8942 }, | 180 | { 23, "iPad3,2", "j2ap", 0x02, 0x8945 }, |
| 227 | { 24, "iPad3,4", "p101ap", 0x00, 0x8955 }, | 181 | { 24, "iPad3,3", "j2aap", 0x04, 0x8945 }, |
| 182 | { 25, "iPad3,4", "p101ap", 0x00, 0x8955 }, | ||
| 183 | { 26, "iPad3,5", "p102ap", 0x02, 0x8955 }, | ||
| 184 | { 27, "iPad3,6", "p103ap", 0x04, 0x8955 }, | ||
| 185 | { 28, "AppleTV2,1", "k66ap", 0x10, 0x8930 }, | ||
| 186 | { 29, "AppleTV3,1", "j33ap", 0x08, 0x8942 }, | ||
| 228 | { -1, NULL, NULL, -1, -1 } | 187 | { -1, NULL, NULL, -1, -1 } |
| 229 | }; | 188 | }; |
| 230 | 189 | ||
