summaryrefslogtreecommitdiffstats
path: root/tools/idevicebackup2.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2020-06-05 20:50:34 +0200
committerGravatar Nikias Bassen2020-06-05 20:50:34 +0200
commit489a673aeeef4706af3986d41c24ab434e77d7d5 (patch)
tree123022859215220cf7f10a483d02bffdf157a0ce /tools/idevicebackup2.c
parent3aa4e243faa8198550cb2851cb6f0b9cbb293812 (diff)
downloadlibimobiledevice-489a673aeeef4706af3986d41c24ab434e77d7d5.tar.gz
libimobiledevice-489a673aeeef4706af3986d41c24ab434e77d7d5.tar.bz2
tools: Unify --network command line switch and add it where missing
Diffstat (limited to 'tools/idevicebackup2.c')
-rw-r--r--tools/idevicebackup2.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index 61302cc..9bbb311 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -1431,6 +1431,7 @@ static void print_usage(int argc, char **argv)
1431 printf("OPTIONS:\n"); 1431 printf("OPTIONS:\n");
1432 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 1432 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
1433 printf(" -s, --source UDID\tuse backup data from device specified by UDID\n"); 1433 printf(" -s, --source UDID\tuse backup data from device specified by UDID\n");
1434 printf(" -n, --network\t\tconnect to network device\n");
1434 printf(" -i, --interactive\trequest passwords interactively\n"); 1435 printf(" -i, --interactive\trequest passwords interactively\n");
1435 printf(" -d, --debug\t\tenable communication debugging\n"); 1436 printf(" -d, --debug\t\tenable communication debugging\n");
1436 printf(" -h, --help\t\tprints usage information\n"); 1437 printf(" -h, --help\t\tprints usage information\n");
@@ -1449,6 +1450,7 @@ int main(int argc, char *argv[])
1449 int i; 1450 int i;
1450 char* udid = NULL; 1451 char* udid = NULL;
1451 char* source_udid = NULL; 1452 char* source_udid = NULL;
1453 int use_network = 0;
1452 lockdownd_service_descriptor_t service = NULL; 1454 lockdownd_service_descriptor_t service = NULL;
1453 int cmd = -1; 1455 int cmd = -1;
1454 int cmd_flags = 0; 1456 int cmd_flags = 0;
@@ -1496,6 +1498,10 @@ int main(int argc, char *argv[])
1496 source_udid = strdup(argv[i]); 1498 source_udid = strdup(argv[i]);
1497 continue; 1499 continue;
1498 } 1500 }
1501 else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
1502 use_network = 1;
1503 continue;
1504 }
1499 else if (!strcmp(argv[i], "-i") || !strcmp(argv[i], "--interactive")) { 1505 else if (!strcmp(argv[i], "-i") || !strcmp(argv[i], "--interactive")) {
1500 interactive_mode = 1; 1506 interactive_mode = 1;
1501 continue; 1507 continue;
@@ -1669,20 +1675,17 @@ int main(int argc, char *argv[])
1669 } 1675 }
1670 1676
1671 idevice_t device = NULL; 1677 idevice_t device = NULL;
1672 if (udid) { 1678 ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX);
1673 ret = idevice_new(&device, udid); 1679 if (ret != IDEVICE_E_SUCCESS) {
1674 if (ret != IDEVICE_E_SUCCESS) { 1680 if (udid) {
1675 printf("No device found with udid %s, is it plugged in?\n", udid); 1681 printf("No device found with udid %s.\n", udid);
1676 return -1; 1682 } else {
1683 printf("No device found.\n");
1677 } 1684 }
1685 return -1;
1678 } 1686 }
1679 else 1687
1680 { 1688 if (!udid) {
1681 ret = idevice_new(&device, NULL);
1682 if (ret != IDEVICE_E_SUCCESS) {
1683 printf("No device found, is it plugged in?\n");
1684 return -1;
1685 }
1686 idevice_get_udid(device, &udid); 1689 idevice_get_udid(device, &udid);
1687 } 1690 }
1688 1691