summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2012-07-17 16:50:02 +0200
committerGravatar Nikias Bassen2012-07-17 16:50:02 +0200
commitdaa24e14060275065fbfda12ed945ee2c7681f5a (patch)
tree9e1aab23a6c79eff6646b92dd8ca0e21a0dc373c /src
parent0a2668fae0ee7846309b1007515852917458d15c (diff)
downloadidevicerestore-daa24e14060275065fbfda12ed945ee2c7681f5a.tar.gz
idevicerestore-daa24e14060275065fbfda12ed945ee2c7681f5a.tar.bz2
restore: Handle baseband update by requested ChipID instead of bbfw filename
Diffstat (limited to 'src')
-rw-r--r--src/restore.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/restore.c b/src/restore.c
index fde666d..da8d258 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -1593,12 +1593,17 @@ int restore_send_baseband_data(restored_client_t restore, struct idevicerestore_
uint64_t bb_snum_size = 0;
unsigned char* bb_nonce = NULL;
uint64_t bb_nonce_size = 0;
+ uint64_t bb_chip_id = 0;
// NOTE: this function is called twice!
// setup request data
plist_t arguments = plist_dict_get_item(message, "Arguments");
if (arguments && plist_get_node_type(arguments) == PLIST_DICT) {
+ plist_t bb_chip_id_node = plist_dict_get_item(arguments, "ChipID");
+ if (bb_chip_id_node && plist_get_node_type(bb_chip_id_node) == PLIST_UINT) {
+ plist_get_uint_val(bb_chip_id_node, &bb_chip_id);
+ }
plist_t bb_cert_id_node = plist_dict_get_item(arguments, "CertID");
if (bb_cert_id_node && plist_get_node_type(bb_cert_id_node) == PLIST_UINT) {
plist_get_uint_val(bb_cert_id_node, &bb_cert_id);
@@ -1658,16 +1663,27 @@ int restore_send_baseband_data(restored_client_t restore, struct idevicerestore_
return -1;
}
- if (strncmp(bbfwpath, "Trek", 4) == 0) {
- res = restore_handle_trek_bbfw(bbfwtmp, response, bb_nonce);
- } else if (strncmp(bbfwpath, "ICE3", 4) == 0) {
- res = restore_handle_ice3_bbfw(bbfwtmp, response, bb_nonce);
- } else {
- error("ERROR: unknown baseband firmware file format '%s'\n", bbfwpath);
- remove(bbfwtmp);
- free(bbfwtmp);
- plist_free(response);
- return -1;
+ switch (bb_chip_id) {
+ // iPhone 4S
+ case 0x5a00e1:
+ res = restore_handle_trek_bbfw(bbfwtmp, response, bb_nonce);
+ break;
+ // iPhone 4 GSM
+ case 0x50:
+ res = restore_handle_ice3_bbfw(bbfwtmp, response, bb_nonce);
+ break;
+ // iPad/iPhone CDMA
+ case 0x005000E1:
+ // iPad 3 4G LTE
+ case 0x004600E1:
+ // iPhone1,1
+ case 0x1B00:
+ default:
+ error("ERROR: Unable to handle baseband firmware file format '%s' for BbChipID %x\n", bbfwpath, (int)bb_chip_id);
+ remove(bbfwtmp);
+ free(bbfwtmp);
+ plist_free(response);
+ return -1;
}
if (res != 0) {