summaryrefslogtreecommitdiffstats
path: root/tools/idevicediagnostics.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevicediagnostics.c')
-rw-r--r--tools/idevicediagnostics.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/idevicediagnostics.c b/tools/idevicediagnostics.c
index 10dab77..410d054 100644
--- a/tools/idevicediagnostics.c
+++ b/tools/idevicediagnostics.c
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
57 lockdownd_client_t lockdown_client = NULL; 57 lockdownd_client_t lockdown_client = NULL;
58 diagnostics_relay_client_t diagnostics_client = NULL; 58 diagnostics_relay_client_t diagnostics_client = NULL;
59 lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; 59 lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR;
60 uint16_t port = 0; 60 lockdownd_service_descriptor_t service = NULL;
61 int result = -1; 61 int result = -1;
62 int i; 62 int i;
63 const char *udid = NULL; 63 const char *udid = NULL;
@@ -173,23 +173,23 @@ int main(int argc, char **argv)
173 goto cleanup; 173 goto cleanup;
174 } 174 }
175 175
176 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown_client, NULL)) { 176 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown_client, "idevicediagnostics")) {
177 idevice_free(device); 177 idevice_free(device);
178 printf("Unable to connect to lockdownd.\n"); 178 printf("Unable to connect to lockdownd.\n");
179 goto cleanup; 179 goto cleanup;
180 } 180 }
181 181
182 /* attempt to use newer diagnostics service available on iOS 5 and later */ 182 /* attempt to use newer diagnostics service available on iOS 5 and later */
183 ret = lockdownd_start_service(lockdown_client, "com.apple.mobile.diagnostics_relay", &port); 183 ret = lockdownd_start_service(lockdown_client, "com.apple.mobile.diagnostics_relay", &service);
184 if (ret != LOCKDOWN_E_SUCCESS) { 184 if (ret != LOCKDOWN_E_SUCCESS) {
185 /* attempt to use older diagnostics service */ 185 /* attempt to use older diagnostics service */
186 ret = lockdownd_start_service(lockdown_client, "com.apple.iosdiagnostics.relay", &port); 186 ret = lockdownd_start_service(lockdown_client, "com.apple.iosdiagnostics.relay", &service);
187 } 187 }
188 188
189 lockdownd_client_free(lockdown_client); 189 lockdownd_client_free(lockdown_client);
190 190
191 if ((ret == LOCKDOWN_E_SUCCESS) && (port > 0)) { 191 if ((ret == LOCKDOWN_E_SUCCESS) && (service->port > 0)) {
192 if (diagnostics_relay_client_new(device, port, &diagnostics_client) != DIAGNOSTICS_RELAY_E_SUCCESS) { 192 if (diagnostics_relay_client_new(device, service, &diagnostics_client) != DIAGNOSTICS_RELAY_E_SUCCESS) {
193 printf("Could not connect to diagnostics_relay!\n"); 193 printf("Could not connect to diagnostics_relay!\n");
194 result = -1; 194 result = -1;
195 } else { 195 } else {
@@ -258,6 +258,11 @@ int main(int argc, char **argv)
258 printf("Could not start diagnostics service!\n"); 258 printf("Could not start diagnostics service!\n");
259 } 259 }
260 260
261 if (service) {
262 lockdownd_service_descriptor_free(service);
263 service = NULL;
264 }
265
261 idevice_free(device); 266 idevice_free(device);
262 267
263cleanup: 268cleanup: