From 4086188a6fd124d948807ad57408dbdad7fac511 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sun, 20 Oct 2019 02:59:05 +0200 Subject: Allow cancelling the 'waiting for trust' loop, and don't spam console in debug mode while waiting for it --- src/normal.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/normal.c b/src/normal.c index 4104f33..c05ed9d 100644 --- a/src/normal.c +++ b/src/normal.c @@ -165,13 +165,22 @@ irecv_device_t normal_get_irecv_device(struct idevicerestore_client_t* client) lockdown_error = lockdownd_client_new_with_handshake(device, &lockdown, "idevicerestore"); if (!(client->flags & FLAG_ERASE) && lockdown_error == LOCKDOWN_E_PAIRING_DIALOG_RESPONSE_PENDING) { info("*** Device is not paired with this computer. Please trust this computer on the device to continue. ***\n"); - while (1) { + if (client->flags & FLAG_DEBUG) { + idevice_set_debug_level(0); + } + while (!(client->flags & FLAG_QUIT)) { lockdown_error = lockdownd_client_new_with_handshake(device, &lockdown, "idevicerestore"); if (lockdown_error != LOCKDOWN_E_PAIRING_DIALOG_RESPONSE_PENDING) { break; } sleep(1); } + if (client->flags & FLAG_DEBUG) { + idevice_set_debug_level(1); + } + if (client->flags & FLAG_QUIT) { + return NULL; + } } if (lockdown_error != LOCKDOWN_E_SUCCESS) { lockdown_error = lockdownd_client_new(device, &lockdown, "idevicerestore"); -- cgit v1.1-32-gdbae