From e201b9f3d3d9fc8dd2c2b60544d9646c27a3c535 Mon Sep 17 00:00:00 2001 From: hydazz Date: Wed, 25 Nov 2026 23:53:54 +1100 Subject: dfu: Don't require a disconnect after iBSS --- src/dfu.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/dfu.c') diff --git a/src/dfu.c b/src/dfu.c index af62e87..b7f61e0 100644 --- a/src/dfu.c +++ b/src/dfu.c @@ -473,15 +473,19 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide /* reconnect */ logger(LL_DEBUG, "Waiting for device to disconnect...\n"); cond_wait_timeout(&client->device_event_cond, &client->device_event_mutex, 10000); - if (client->mode != MODE_UNKNOWN || (client->flags & FLAG_QUIT)) { + /* A device in DFU over Debug USB (KIS) can keep that USB device + * after iBSS and present recovery mode through it instead. */ + if ((client->mode != MODE_UNKNOWN && client->mode != MODE_RECOVERY) || (client->flags & FLAG_QUIT)) { mutex_unlock(&client->device_event_mutex); if (!(client->flags & FLAG_QUIT)) { logger(LL_ERROR, "Device did not disconnect. Possibly invalid iBSS. Reset device and try again.\n"); } return -1; } - logger(LL_DEBUG, "Waiting for device to reconnect...\n"); - cond_wait_timeout(&client->device_event_cond, &client->device_event_mutex, 10000); + if (client->mode == MODE_UNKNOWN) { + logger(LL_DEBUG, "Waiting for device to reconnect...\n"); + cond_wait_timeout(&client->device_event_cond, &client->device_event_mutex, 10000); + } if ((client->mode != MODE_DFU && client->mode != MODE_RECOVERY) || (client->flags & FLAG_QUIT)) { mutex_unlock(&client->device_event_mutex); if (!(client->flags & FLAG_QUIT)) { -- cgit v1.1-32-gdbae