summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ideviceinstaller.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c
index e45bb12..2334199 100644
--- a/src/ideviceinstaller.c
+++ b/src/ideviceinstaller.c
@@ -117,6 +117,7 @@ int use_notifier = 0;
117int notification_expected = 0; 117int notification_expected = 0;
118int is_device_connected = 0; 118int is_device_connected = 0;
119int command_completed = 0; 119int command_completed = 0;
120int ignore_events = 0;
120int err_occurred = 0; 121int err_occurred = 0;
121int notified = 0; 122int notified = 0;
122 123
@@ -351,6 +352,9 @@ static int zip_get_app_directory(struct zip* zf, char** path)
351 352
352static void idevice_event_callback(const idevice_event_t* event, void* userdata) 353static void idevice_event_callback(const idevice_event_t* event, void* userdata)
353{ 354{
355 if (ignore_events) {
356 return;
357 }
354 if (event->event == IDEVICE_DEVICE_REMOVE) { 358 if (event->event == IDEVICE_DEVICE_REMOVE) {
355 if (!strcmp(udid, event->udid)) { 359 if (!strcmp(udid, event->udid)) {
356 fprintf(stderr, "ideviceinstaller: Device removed\n"); 360 fprintf(stderr, "ideviceinstaller: Device removed\n");
@@ -362,6 +366,7 @@ static void idevice_event_callback(const idevice_event_t* event, void* userdata)
362static void idevice_wait_for_command_to_complete() 366static void idevice_wait_for_command_to_complete()
363{ 367{
364 is_device_connected = 1; 368 is_device_connected = 1;
369 ignore_events = 0;
365 370
366 /* subscribe to make sure to exit on device removal */ 371 /* subscribe to make sure to exit on device removal */
367 idevice_event_subscribe(idevice_event_callback, NULL); 372 idevice_event_subscribe(idevice_event_callback, NULL);
@@ -377,6 +382,7 @@ static void idevice_wait_for_command_to_complete()
377 wait_ms(50); 382 wait_ms(50);
378 } 383 }
379 384
385 ignore_events = 1;
380 idevice_event_unsubscribe(); 386 idevice_event_unsubscribe();
381} 387}
382 388