diff options
| -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) { | |||
| 250 | 250 | ||
| 251 | void print_usage() { | 251 | void print_usage() { |
| 252 | printf("iRecovery - iDevice Recovery Utility\n"); | 252 | printf("iRecovery - iDevice Recovery Utility\n"); |
| 253 | printf("Usage: ./irecovery [args]\n"); | 253 | printf("Usage: irecovery [args]\n"); |
| 254 | printf("\t-i <ecid>\tTarget specific device by its hexadecimal ECID\n"); | ||
| 254 | printf("\t-v\t\tStart irecovery in verbose mode.\n"); | 255 | printf("\t-v\t\tStart irecovery in verbose mode.\n"); |
| 255 | printf("\t-c <cmd>\tSend command to client.\n"); | 256 | printf("\t-c <cmd>\tSend command to client.\n"); |
| 256 | printf("\t-f <file>\tSend file to client.\n"); | 257 | printf("\t-f <file>\tSend file to client.\n"); |
| @@ -266,11 +267,26 @@ int main(int argc, char* argv[]) { | |||
| 266 | int i = 0; | 267 | int i = 0; |
| 267 | int opt = 0; | 268 | int opt = 0; |
| 268 | int action = 0; | 269 | int action = 0; |
| 270 | unsigned long long ecid = 0; | ||
| 269 | char* argument = NULL; | 271 | char* argument = NULL; |
| 270 | irecv_error_t error = 0; | 272 | irecv_error_t error = 0; |
| 271 | if (argc == 1) print_usage(); | 273 | if (argc == 1) print_usage(); |
| 272 | while ((opt = getopt(argc, argv, "vhrsc:f:e:k::")) > 0) { | 274 | while ((opt = getopt(argc, argv, "i:vhrsc:f:e:k::")) > 0) { |
| 273 | switch (opt) { | 275 | switch (opt) { |
| 276 | case 'i': | ||
| 277 | if (optarg) { | ||
| 278 | char* tail = NULL; | ||
| 279 | ecid = strtoull(optarg, &tail, 16); | ||
| 280 | if (tail && (tail[0] != '\0')) { | ||
| 281 | ecid = 0; | ||
| 282 | } | ||
| 283 | if (ecid == 0) { | ||
| 284 | fprintf(stderr, "ERROR: Could not parse ECID from argument '%s'\n", optarg); | ||
| 285 | return -1; | ||
| 286 | } | ||
| 287 | } | ||
| 288 | break; | ||
| 289 | |||
| 274 | case 'v': | 290 | case 'v': |
| 275 | verbose += 1; | 291 | verbose += 1; |
| 276 | break; | 292 | break; |
| @@ -320,7 +336,7 @@ int main(int argc, char* argv[]) { | |||
| 320 | for (i = 0; i <= 5; i++) { | 336 | for (i = 0; i <= 5; i++) { |
| 321 | debug("Attempting to connect... \n"); | 337 | debug("Attempting to connect... \n"); |
| 322 | 338 | ||
| 323 | if (irecv_open(&client) != IRECV_E_SUCCESS) | 339 | if (irecv_open(&client, ecid) != IRECV_E_SUCCESS) |
| 324 | sleep(1); | 340 | sleep(1); |
| 325 | else | 341 | else |
| 326 | break; | 342 | break; |
