summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Rudolf Tammekivi2018-03-23 01:33:31 +0100
committerGravatar Nikias Bassen2018-03-23 01:33:31 +0100
commit723c8cb0d147ceffb5f7c526b0a825c167ae06ea (patch)
tree240c496f6714c193fcd4fd36dcfbd677572fe658
parentc37f4ce4c2b8b674562a5d8aee4ebbcbd04402ac (diff)
downloadideviceinstaller-723c8cb0d147ceffb5f7c526b0a825c167ae06ea.tar.gz
ideviceinstaller-723c8cb0d147ceffb5f7c526b0a825c167ae06ea.tar.bz2
Fix wrong device disconnected detection
Currently ideviceinstaller hooked to event IDEVICE_DEVICE_REMOVE, but did not check UDID, so it bailed out if a random idevice was disconnected. Also added a message to indicate when a device is disconnected.
-rw-r--r--src/ideviceinstaller.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c
index 12f2caf..5ff9dad 100644
--- a/src/ideviceinstaller.c
+++ b/src/ideviceinstaller.c
@@ -323,7 +323,10 @@ static int zip_get_app_directory(struct zip* zf, char** path)
323static void idevice_event_callback(const idevice_event_t* event, void* userdata) 323static void idevice_event_callback(const idevice_event_t* event, void* userdata)
324{ 324{
325 if (event->event == IDEVICE_DEVICE_REMOVE) { 325 if (event->event == IDEVICE_DEVICE_REMOVE) {
326 is_device_connected = 0; 326 if (!strcmp(udid, event->udid)) {
327 fprintf(stderr, "ideviceinstaller: Device removed\n");
328 is_device_connected = 0;
329 }
327 } 330 }
328} 331}
329 332
@@ -657,6 +660,10 @@ int main(int argc, char **argv)
657 return -1; 660 return -1;
658 } 661 }
659 662
663 if (!udid) {
664 idevice_get_udid(phone, &udid);
665 }
666
660 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "ideviceinstaller")) { 667 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "ideviceinstaller")) {
661 fprintf(stderr, "Could not connect to lockdownd. Exiting.\n"); 668 fprintf(stderr, "Could not connect to lockdownd. Exiting.\n");
662 goto leave_cleanup; 669 goto leave_cleanup;