summaryrefslogtreecommitdiffstats
path: root/src/ideviceinstaller.c
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 /src/ideviceinstaller.c
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.
Diffstat (limited to 'src/ideviceinstaller.c')
-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)
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;