diff options
author | Nikias Bassen | 2012-07-05 00:27:16 +0200 |
---|---|---|
committer | Nikias Bassen | 2012-07-05 00:27:16 +0200 |
commit | 0114b24c999f705fcb69b539482dd45350479010 (patch) | |
tree | 0fd57365cbaebc31083b1dd853b497ed83d3af0c | |
parent | 1b4cfb7746eac259d2b555d3abcb20069c9d9834 (diff) | |
download | libirecovery-0114b24c999f705fcb69b539482dd45350479010.tar.gz libirecovery-0114b24c999f705fcb69b539482dd45350479010.tar.bz2 |
irecovery: allow targeting device by ECID
-rw-r--r-- | irecovery.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/irecovery.c b/irecovery.c index a7d6429..89f30a6 100644 --- a/irecovery.c +++ b/irecovery.c @@ -250,7 +250,8 @@ void print_progress_bar(double progress) { void print_usage() { printf("iRecovery - iDevice Recovery Utility\n"); - printf("Usage: ./irecovery [args]\n"); + printf("Usage: irecovery [args]\n"); + printf("\t-i <ecid>\tTarget specific device by its hexadecimal ECID\n"); printf("\t-v\t\tStart irecovery in verbose mode.\n"); printf("\t-c <cmd>\tSend command to client.\n"); printf("\t-f <file>\tSend file to client.\n"); @@ -266,11 +267,26 @@ int main(int argc, char* argv[]) { int i = 0; int opt = 0; int action = 0; + unsigned long long ecid = 0; char* argument = NULL; irecv_error_t error = 0; if (argc == 1) print_usage(); - while ((opt = getopt(argc, argv, "vhrsc:f:e:k::")) > 0) { + while ((opt = getopt(argc, argv, "i:vhrsc:f:e:k::")) > 0) { switch (opt) { + case 'i': + if (optarg) { + char* tail = NULL; + ecid = strtoull(optarg, &tail, 16); + if (tail && (tail[0] != '\0')) { + ecid = 0; + } + if (ecid == 0) { + fprintf(stderr, "ERROR: Could not parse ECID from argument '%s'\n", optarg); + return -1; + } + } + break; + case 'v': verbose += 1; break; @@ -320,7 +336,7 @@ int main(int argc, char* argv[]) { for (i = 0; i <= 5; i++) { debug("Attempting to connect... \n"); - if (irecv_open(&client) != IRECV_E_SUCCESS) + if (irecv_open(&client, ecid) != IRECV_E_SUCCESS) sleep(1); else break; |