summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-10-20 03:35:34 +0200
committerGravatar Nikias Bassen2019-10-20 03:35:34 +0200
commitd04ce021b928644cef3b27e025ffc8dae413cd71 (patch)
treed7293619867881dc76dabf7b701ff012b4bb4ed6
parent4086188a6fd124d948807ad57408dbdad7fac511 (diff)
downloadidevicerestore-d04ce021b928644cef3b27e025ffc8dae413cd71.tar.gz
idevicerestore-d04ce021b928644cef3b27e025ffc8dae413cd71.tar.bz2
Ignore device add events after device entered restore mode
-rw-r--r--src/common.h1
-rw-r--r--src/idevicerestore.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index dbd2a41..e8e4d44 100644
--- a/src/common.h
+++ b/src/common.h
@@ -109,6 +109,7 @@ struct idevicerestore_client_t {
void* idevice_e_ctx;
mutex_t device_event_mutex;
cond_t device_event_cond;
+ int ignore_device_add_events;
};
extern struct idevicerestore_mode_t idevicerestore_modes[];
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index d7f2a85..2e38933 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -208,6 +208,9 @@ static void idevice_event_cb(const idevice_event_t *event, void *userdata)
{
struct idevicerestore_client_t *client = (struct idevicerestore_client_t*)userdata;
if (event->event == IDEVICE_DEVICE_ADD) {
+ if (client->ignore_device_add_events) {
+ return;
+ }
if (normal_check_mode(client) == 0) {
mutex_lock(&client->device_event_mutex);
client->mode = &idevicerestore_modes[MODE_NORMAL];
@@ -226,6 +229,7 @@ static void idevice_event_cb(const idevice_event_t *event, void *userdata)
mutex_lock(&client->device_event_mutex);
client->mode = &idevicerestore_modes[MODE_UNKNOWN];
debug("%s: device " FMT_016llx " (udid: %s) disconnected\n", __func__, client->ecid, client->udid);
+ client->ignore_device_add_events = 0;
cond_signal(&client->device_event_cond);
mutex_unlock(&client->device_event_mutex);
}
@@ -1309,6 +1313,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
// device is finally in restore mode, let's do this
if (client->mode->index == MODE_RESTORE) {
+ client->ignore_device_add_events = 1;
info("About to restore device... \n");
result = restore_device(client, build_identity, filesystem);
if (result < 0) {