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.
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 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 @@
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;