summaryrefslogtreecommitdiffstats
path: root/tools/idevicebackup.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevicebackup.c')
-rw-r--r--tools/idevicebackup.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index 171ab7e..dfd7b8b 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -676,6 +676,7 @@ static void print_usage(int argc, char **argv)
676 printf("\n"); 676 printf("\n");
677 printf("OPTIONS:\n"); 677 printf("OPTIONS:\n");
678 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 678 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
679 printf(" -n, --network\t\tconnect to network device\n");
679 printf(" -d, --debug\t\tenable communication debugging\n"); 680 printf(" -d, --debug\t\tenable communication debugging\n");
680 printf(" -h, --help\t\tprints usage information\n"); 681 printf(" -h, --help\t\tprints usage information\n");
681 printf(" -v, --version\t\tprints version information\n"); 682 printf(" -v, --version\t\tprints version information\n");
@@ -690,6 +691,7 @@ int main(int argc, char *argv[])
690 lockdownd_error_t ldret = LOCKDOWN_E_UNKNOWN_ERROR; 691 lockdownd_error_t ldret = LOCKDOWN_E_UNKNOWN_ERROR;
691 int i; 692 int i;
692 char* udid = NULL; 693 char* udid = NULL;
694 int use_network = 0;
693 lockdownd_service_descriptor_t service = NULL; 695 lockdownd_service_descriptor_t service = NULL;
694 int cmd = -1; 696 int cmd = -1;
695 int is_full_backup = 0; 697 int is_full_backup = 0;
@@ -729,6 +731,10 @@ int main(int argc, char *argv[])
729 udid = strdup(argv[i]); 731 udid = strdup(argv[i]);
730 continue; 732 continue;
731 } 733 }
734 else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
735 use_network = 1;
736 continue;
737 }
732 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { 738 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
733 print_usage(argc, argv); 739 print_usage(argc, argv);
734 return 0; 740 return 0;
@@ -783,20 +789,14 @@ int main(int argc, char *argv[])
783 789
784 printf("Backup directory is \"%s\"\n", backup_directory); 790 printf("Backup directory is \"%s\"\n", backup_directory);
785 791
786 if (udid) { 792 ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX);
787 ret = idevice_new(&device, udid); 793 if (ret != IDEVICE_E_SUCCESS) {
788 if (ret != IDEVICE_E_SUCCESS) { 794 if (udid) {
789 printf("No device found with udid %s, is it plugged in?\n", udid); 795 printf("No device found with udid %s.\n", udid);
790 return -1; 796 } else {
791 } 797 printf("No device found.\n");
792 }
793 else
794 {
795 ret = idevice_new(&device, NULL);
796 if (ret != IDEVICE_E_SUCCESS) {
797 printf("No device found, is it plugged in?\n");
798 return -1;
799 } 798 }
799 return -1;
800 } 800 }
801 801
802 if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, TOOL_NAME))) { 802 if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, TOOL_NAME))) {