From 3f8dea9bd12c4b4c52224b1a84835fa56df53fb2 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Tue, 19 Nov 2013 21:38:31 +0100 Subject: Add helper function to check if device supports image4 format --- src/idevicerestore.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/idevicerestore.c') diff --git a/src/idevicerestore.c b/src/idevicerestore.c index e9580bd..a0f5a87 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -365,6 +365,9 @@ int idevicerestore_start(struct idevicerestore_client_t* client) info("Product Version: %s\n", client->version); info("Product Build: %s Major: %d\n", client->build, client->build_major); + client->image4supported = is_image4_supported(client); + info("Device supports Image4: %s\n", (client->image4supported) ? "true" : "false"); + if (client->flags & FLAG_CUSTOM) { /* prevent signing custom firmware */ tss_enabled = 0; @@ -1182,6 +1185,27 @@ const char* check_product_type(struct idevicerestore_client_t* client) { return product_type; } +int is_image4_supported(struct idevicerestore_client_t* client) +{ + int res = 0; + + switch (client->mode->index) { + case MODE_NORMAL: + res = normal_is_image4_supported(client); + break; + case MODE_DFU: + res = dfu_is_image4_supported(client); + break; + case MODE_RECOVERY: + res = recovery_is_image4_supported(client); + break; + default: + error("ERROR: Device is in an invalid state\n"); + return 0; + } + return res; +} + int get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid) { switch (client->mode->index) { case MODE_NORMAL: -- cgit v1.1-32-gdbae