summaryrefslogtreecommitdiffstats
path: root/tools/idevicecrashreport.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-07-12 18:45:46 +0700
committerGravatar Nikias Bassen2019-07-12 18:45:46 +0700
commit2332655423c1616d8e37ece7f33e98be0e218504 (patch)
tree8d83eb2aa8c6ed521b50d6242518ecb1d819726b /tools/idevicecrashreport.c
parent8510a9b290bc92993d2ae57a965b7f36325e1aa9 (diff)
downloadlibimobiledevice-2332655423c1616d8e37ece7f33e98be0e218504.tar.gz
libimobiledevice-2332655423c1616d8e37ece7f33e98be0e218504.tar.bz2
Fix service startup in idevicecrashreport for iOS 13
Diffstat (limited to 'tools/idevicecrashreport.c')
-rw-r--r--tools/idevicecrashreport.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c
index d0b2c7a..533265c 100644
--- a/tools/idevicecrashreport.c
+++ b/tools/idevicecrashreport.c
@@ -30,9 +30,10 @@
30#include <unistd.h> 30#include <unistd.h>
31#include "common/utils.h" 31#include "common/utils.h"
32 32
33#include <libimobiledevice/afc.h>
34#include <libimobiledevice/lockdown.h>
35#include <libimobiledevice/libimobiledevice.h> 33#include <libimobiledevice/libimobiledevice.h>
34#include <libimobiledevice/lockdown.h>
35#include <libimobiledevice/service.h>
36#include <libimobiledevice/afc.h>
36#include <plist/plist.h> 37#include <plist/plist.h>
37 38
38#ifdef WIN32 39#ifdef WIN32
@@ -55,7 +56,8 @@ static int file_exists(const char* path)
55#endif 56#endif
56} 57}
57 58
58static int extract_raw_crash_report(const char* filename) { 59static int extract_raw_crash_report(const char* filename)
60{
59 int res = 0; 61 int res = 0;
60 plist_t report = NULL; 62 plist_t report = NULL;
61 char* raw = NULL; 63 char* raw = NULL;
@@ -307,7 +309,8 @@ static void print_usage(int argc, char **argv)
307 printf("Homepage: <" PACKAGE_URL ">\n"); 309 printf("Homepage: <" PACKAGE_URL ">\n");
308} 310}
309 311
310int main(int argc, char* argv[]) { 312int main(int argc, char* argv[])
313{
311 idevice_t device = NULL; 314 idevice_t device = NULL;
312 lockdownd_client_t lockdownd = NULL; 315 lockdownd_client_t lockdownd = NULL;
313 afc_client_t afc = NULL; 316 afc_client_t afc = NULL;
@@ -396,9 +399,11 @@ int main(int argc, char* argv[]) {
396 } 399 }
397 400
398 /* trigger move operation on device */ 401 /* trigger move operation on device */
399 idevice_connection_t connection = NULL; 402 service_client_t svcmove = NULL;
400 device_error = idevice_connect(device, service->port, &connection); 403 service_error_t service_error = service_client_new(device, service, &svcmove);
401 if(device_error != IDEVICE_E_SUCCESS) { 404 lockdownd_service_descriptor_free(service);
405 service = NULL;
406 if (service_error != SERVICE_E_SUCCESS) {
402 lockdownd_client_free(lockdownd); 407 lockdownd_client_free(lockdownd);
403 idevice_free(device); 408 idevice_free(device);
404 return -1; 409 return -1;
@@ -410,23 +415,18 @@ int main(int argc, char* argv[]) {
410 int attempts = 0; 415 int attempts = 0;
411 while ((strncmp(ping, "ping", 4) != 0) && (attempts < 10)) { 416 while ((strncmp(ping, "ping", 4) != 0) && (attempts < 10)) {
412 uint32_t bytes = 0; 417 uint32_t bytes = 0;
413 device_error = idevice_connection_receive_timeout(connection, ping, 4, &bytes, 2000); 418 service_error = service_receive_with_timeout(svcmove, ping, 4, &bytes, 2000);
414 if (device_error != IDEVICE_E_SUCCESS) { 419 if (service_error == SERVICE_E_SUCCESS || service_error == SERVICE_E_TIMEOUT) {
415 attempts++; 420 attempts++;
416 continue; 421 continue;
417 } else if (device_error < 0) { 422 } else {
418 fprintf(stderr, "ERROR: Crash logs could not be moved. Connection interrupted.\n"); 423 fprintf(stderr, "ERROR: Crash logs could not be moved. Connection interrupted (%d).\n", service_error);
419 break; 424 break;
420 } 425 }
421 } 426 }
422 idevice_disconnect(connection); 427 service_client_free(svcmove);
423 free(ping); 428 free(ping);
424 429
425 if (service) {
426 lockdownd_service_descriptor_free(service);
427 service = NULL;
428 }
429
430 if (device_error != IDEVICE_E_SUCCESS || attempts > 10) { 430 if (device_error != IDEVICE_E_SUCCESS || attempts > 10) {
431 fprintf(stderr, "ERROR: Failed to receive ping message from crash report mover.\n"); 431 fprintf(stderr, "ERROR: Failed to receive ping message from crash report mover.\n");
432 lockdownd_client_free(lockdownd); 432 lockdownd_client_free(lockdownd);