From ca392863d770e522285615af4e1a9c1cd38fef33 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 16 Jul 2012 15:51:11 +0200 Subject: mass replace uuid->udid and raise libimobiledevice requirement to >= 1.1.4 --- src/common.h | 2 +- src/idevicerestore.c | 16 ++++++++-------- src/normal.c | 10 +++++----- src/restore.c | 22 +++++++++++----------- src/restore.h | 6 +++--- 5 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/common.h b/src/common.h index c30f98f..748acbf 100644 --- a/src/common.h +++ b/src/common.h @@ -77,7 +77,7 @@ struct idevicerestore_client_t { uint64_t ecid; unsigned char* nonce; int nonce_size; - char* uuid; + char* udid; char* srnm; const char* ipsw; const char* filesystem; diff --git a/src/idevicerestore.c b/src/idevicerestore.c index d6ead2f..8fc3938 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -46,7 +46,7 @@ int use_apple_server; static struct option longopts[] = { { "ecid", required_argument, NULL, 'i' }, - { "uuid", required_argument, NULL, 'u' }, + { "udid", required_argument, NULL, 'u' }, { "debug", no_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, { "erase", no_argument, NULL, 'e' }, @@ -64,7 +64,7 @@ void usage(int argc, char* argv[]) { printf("Restore/upgrade IPSW firmware FILE to an iPhone/iPod Touch.\n"); printf(" -i|--ecid ECID target specific device by its hexadecimal ECID\n"); printf(" e.g. 0xaabb123456 or 00000012AABBCCDD\n"); - printf(" -u|--uuid UUID target specific device by its 40-digit device UUID\n"); + printf(" -u|--udid UDID target specific device by its 40-digit device UDID\n"); printf(" NOTE: only works with devices in normal mode.\n"); printf(" -d|--debug enable communication debugging\n"); printf(" -h|--help prints usage information\n"); @@ -134,7 +134,7 @@ int main(int argc, char* argv[]) { int opt = 0; int optindex = 0; char* ipsw = NULL; - char* uuid = NULL; + char* udid = NULL; int tss_enabled = 0; int shsh_only = 0; char* shsh_dir = NULL; @@ -190,7 +190,7 @@ int main(int argc, char* argv[]) { break; case 'u': - uuid = optarg; + udid = optarg; break; case 't': @@ -222,7 +222,7 @@ int main(int argc, char* argv[]) { irecv_set_debug_level(1); } - client->uuid = uuid; + client->udid = udid; client->ipsw = ipsw; // update version data (from cache, or apple if too old) @@ -751,7 +751,7 @@ int check_mode(struct idevicerestore_client_t* client) { mode = MODE_NORMAL; } - else if (!client->ecid && client->uuid && (restore_check_mode(client->uuid) == 0)) { + else if (!client->ecid && client->udid && (restore_check_mode(client->udid) == 0)) { mode = MODE_RESTORE; } @@ -766,8 +766,8 @@ int check_device(struct idevicerestore_client_t* client) { switch (client->mode->index) { case MODE_RESTORE: - if (!client->ecid && client->uuid) { - device = restore_check_device(client->uuid); + if (!client->ecid && client->udid) { + device = restore_check_device(client->udid); if (device < 0) { device = DEVICE_UNKNOWN; } diff --git a/src/normal.c b/src/normal.c index 8547b2c..21a51c7 100644 --- a/src/normal.c +++ b/src/normal.c @@ -102,12 +102,12 @@ static int normal_idevice_new(struct idevicerestore_client_t* client, idevice_t* } device_error = idevice_new(&dev, devices[j]); if (device_error != IDEVICE_E_SUCCESS) { - error("ERROR: %s: can't open device with UUID %s", __func__, devices[j]); + error("ERROR: %s: can't open device with UDID %s", __func__, devices[j]); continue; } if (lockdownd_client_new(dev, &lockdown, "idevicerestore") != LOCKDOWN_E_SUCCESS) { - error("ERROR: %s: can't connect to lockdownd on device with UUID %s", __func__, devices[j]); + error("ERROR: %s: can't connect to lockdownd on device with UDID %s", __func__, devices[j]); continue; } @@ -144,7 +144,7 @@ static int normal_idevice_new(struct idevicerestore_client_t* client, idevice_t* lockdownd_client_free(lockdown); lockdown = NULL; } - client->uuid = strdup(devices[j]); + client->udid = strdup(devices[j]); *device = dev; break; } @@ -265,7 +265,7 @@ int normal_enter_recovery(struct idevicerestore_client_t* client) { idevice_error_t device_error = IDEVICE_E_SUCCESS; lockdownd_error_t lockdown_error = LOCKDOWN_E_SUCCESS; - device_error = idevice_new(&device, client->uuid); + device_error = idevice_new(&device, client->udid); if (device_error != IDEVICE_E_SUCCESS) { error("ERROR: Unable to find device\n"); return -1; @@ -316,7 +316,7 @@ int normal_get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid) { idevice_error_t device_error = IDEVICE_E_SUCCESS; lockdownd_error_t lockdown_error = IDEVICE_E_SUCCESS; - device_error = idevice_new(&device, client->uuid); + device_error = idevice_new(&device, client->udid); if (device_error != IDEVICE_E_SUCCESS) { return -1; } diff --git a/src/restore.c b/src/restore.c index df39b9d..e96fed9 100644 --- a/src/restore.c +++ b/src/restore.c @@ -86,7 +86,7 @@ void restore_client_free(struct idevicerestore_client_t* client) { } } -int restore_check_mode(const char* uuid) { +int restore_check_mode(const char* udid) { char* type = NULL; uint64_t version = 0; idevice_t device = NULL; @@ -94,7 +94,7 @@ int restore_check_mode(const char* uuid) { idevice_error_t device_error = IDEVICE_E_SUCCESS; restored_error_t restore_error = RESTORE_E_SUCCESS; - device_error = idevice_new(&device, uuid); + device_error = idevice_new(&device, udid); if (device_error != IDEVICE_E_SUCCESS) { return -1; } @@ -119,7 +119,7 @@ int restore_check_mode(const char* uuid) { return 0; } -int restore_check_device(const char* uuid) { +int restore_check_device(const char* udid) { int i = 0; char* type = NULL; char* model = NULL; @@ -130,7 +130,7 @@ int restore_check_device(const char* uuid) { idevice_error_t device_error = IDEVICE_E_SUCCESS; restored_error_t restore_error = RESTORE_E_SUCCESS; - device_error = idevice_new(&device, uuid); + device_error = idevice_new(&device, udid); if (device_error != IDEVICE_E_SUCCESS) { return -1; } @@ -182,7 +182,7 @@ void restore_device_callback(const idevice_event_t* event, void* userdata) { struct idevicerestore_client_t* client = (struct idevicerestore_client_t*) userdata; if (event->event == IDEVICE_DEVICE_ADD) { restore_device_connected = 1; - client->uuid = strdup(event->uuid); + client->udid = strdup(event->udid); } else if (event->event == IDEVICE_DEVICE_REMOVE) { restore_device_connected = 0; client->flags |= FLAG_QUIT; @@ -208,7 +208,7 @@ int restore_reboot(struct idevicerestore_client_t* client) { return 0; } -static int restore_is_current_device(struct idevicerestore_client_t* client, const char* uuid) +static int restore_is_current_device(struct idevicerestore_client_t* client, const char* udid) { if (!client) { return 0; @@ -225,9 +225,9 @@ static int restore_is_current_device(struct idevicerestore_client_t* client, con char *type = NULL; uint64_t version = 0; - device_error = idevice_new(&device, uuid); + device_error = idevice_new(&device, udid); if (device_error != IDEVICE_E_SUCCESS) { - error("ERROR: %s: can't open device with UUID %s", __func__, uuid); + error("ERROR: %s: can't open device with UDID %s", __func__, udid); return 0; } @@ -241,7 +241,7 @@ static int restore_is_current_device(struct idevicerestore_client_t* client, con if ((restore_error == RESTORE_E_SUCCESS) && type && (strcmp(type, "com.apple.mobile.restored") == 0)) { debug("%s: Connected to %s, version %d\n", __func__, type, (int)version); } else { - info("%s: device %s is not in restore mode\n", __func__, uuid); + info("%s: device %s is not in restore mode\n", __func__, udid); restored_client_free(restored); idevice_free(device); return 0; @@ -319,7 +319,7 @@ int restore_open_with_timeout(struct idevicerestore_client_t* client) { for (j = 0; j < num_devices; j++) { if (restore_is_current_device(client, devices[j])) { restore_device_connected = 1; - client->uuid = strdup(devices[j]); + client->udid = strdup(devices[j]); break; } } @@ -343,7 +343,7 @@ int restore_open_with_timeout(struct idevicerestore_client_t* client) { } info("Connecting now\n"); - device_error = idevice_new(&device, client->uuid); + device_error = idevice_new(&device, client->udid); if (device_error != IDEVICE_E_SUCCESS) { return -1; } diff --git a/src/restore.h b/src/restore.h index deb8506..6e9c96e 100644 --- a/src/restore.h +++ b/src/restore.h @@ -33,15 +33,15 @@ extern "C" { struct restore_client_t { plist_t tss; idevice_t device; - char* uuid; + char* udid; unsigned int operation; const char* filesystem; uint64_t protocol_version; restored_client_t client; }; -int restore_check_mode(const char* uuid); -int restore_check_device(const char* uuid); +int restore_check_mode(const char* udid); +int restore_check_device(const char* udid); int restore_client_new(struct idevicerestore_client_t* client); void restore_client_free(struct idevicerestore_client_t* client); int restore_reboot(struct idevicerestore_client_t* client); -- cgit v1.1-32-gdbae