From 723c8cb0d147ceffb5f7c526b0a825c167ae06ea Mon Sep 17 00:00:00 2001 From: Rudolf Tammekivi Date: Fri, 23 Mar 2018 01:33:31 +0100 Subject: 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. --- src/ideviceinstaller.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') 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) static void idevice_event_callback(const idevice_event_t* event, void* userdata) { if (event->event == IDEVICE_DEVICE_REMOVE) { - is_device_connected = 0; + if (!strcmp(udid, event->udid)) { + fprintf(stderr, "ideviceinstaller: Device removed\n"); + is_device_connected = 0; + } } } @@ -657,6 +660,10 @@ int main(int argc, char **argv) return -1; } + if (!udid) { + idevice_get_udid(phone, &udid); + } + if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(phone, &client, "ideviceinstaller")) { fprintf(stderr, "Could not connect to lockdownd. Exiting.\n"); goto leave_cleanup; -- cgit v1.1-32-gdbae