From ce663f79d1d58f5ce6809a24bbb1e92a800d7ff8 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sat, 30 Dec 2017 06:23:45 +0000 Subject: Offer plain progress reports. --- src/idevicerestore.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 5601082..03e4811 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -73,6 +73,7 @@ static struct option longopts[] = { { "no-action", no_argument, NULL, 'n' }, { "cache-path", required_argument, NULL, 'C' }, { "no-input", no_argument, NULL, 'y' }, + { "plain-progress", no_argument, NULL, 'P' }, { "restore-mode", no_argument, NULL, 'R' }, { "ticket", required_argument, NULL, 'T' }, { NULL, 0, NULL, 0 } @@ -119,6 +120,7 @@ static void usage(int argc, char* argv[], int err) " -t, --shsh Fetch TSS record and save to .shsh file, then exit\n" \ " -k, --keep-pers Write personalized components to files for debugging\n" \ " -p, --pwn Put device in pwned DFU mode and exit (limera1n devices only)\n" \ + " -P, --plain-progress Print progress as plain step and progress\n" \ " -R, --restore-mode Allow restoring from Restore mode\n" \ " -T, --ticket PATH Use file at PATH to send as AP ticket\n" \ "\n" \ @@ -1510,6 +1512,12 @@ static void handle_signal(int sig) } } +void plain_progress_cb(int step, double step_progress, void* userdata) +{ + printf("progress: %u %f\n", step, step_progress); + fflush(stdout); +} + int main(int argc, char* argv[]) { int opt = 0; int optindex = 0; @@ -1545,7 +1553,7 @@ int main(int argc, char* argv[]) { client->flags |= FLAG_INTERACTIVE; } - while ((opt = getopt_long(argc, argv, "dhcesxtpli:u:nC:kyRT:", longopts, &optindex)) > 0) { + while ((opt = getopt_long(argc, argv, "dhcesxtpli:u:nC:kyPRT:", longopts, &optindex)) > 0) { switch (opt) { case 'h': usage(argc, argv, 0); @@ -1622,6 +1630,10 @@ int main(int argc, char* argv[]) { client->flags &= ~FLAG_INTERACTIVE; break; + case 'P': + idevicerestore_set_progress_callback(client, plain_progress_cb, NULL); + break; + case 'R': client->flags |= FLAG_ALLOW_RESTORE_MODE; break; -- cgit v1.1-32-gdbae