summaryrefslogtreecommitdiffstats
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
parent3aa4e243faa8198550cb2851cb6f0b9cbb293812 (diff)
downloadlibimobiledevice-489a673aeeef4706af3986d41c24ab434e77d7d5.tar.gz
libimobiledevice-489a673aeeef4706af3986d41c24ab434e77d7d5.tar.bz2
tools: Unify --network command line switch and add it where missing
-rw-r--r--tools/idevicebackup.c26
-rw-r--r--tools/idevicebackup2.c27
-rw-r--r--tools/idevicecrashreport.c12
-rw-r--r--tools/idevicedate.c12
-rw-r--r--tools/idevicedebug.c11
-rw-r--r--tools/idevicedebugserverproxy.c12
-rw-r--r--tools/idevicediagnostics.c12
-rw-r--r--tools/ideviceenterrecovery.c2
-rw-r--r--tools/ideviceimagemounter.c28
-rw-r--r--tools/ideviceinfo.c8
-rw-r--r--tools/idevicename.c18
-rw-r--r--tools/idevicenotificationproxy.c12
-rw-r--r--tools/idevicepair.c33
-rw-r--r--tools/ideviceprovision.c12
-rw-r--r--tools/idevicescreenshot.c12
-rw-r--r--tools/idevicesetlocation.c8
-rw-r--r--tools/idevicesyslog.c8
17 files changed, 159 insertions, 94 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))) {
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
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c
index 0fc40c6..2945111 100644
--- a/tools/idevicecrashreport.c
+++ b/tools/idevicecrashreport.c
@@ -309,6 +309,7 @@ static void print_usage(int argc, char **argv)
309 printf("\n"); 309 printf("\n");
310 printf("OPTIONS:\n"); 310 printf("OPTIONS:\n");
311 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 311 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
312 printf(" -n, --network\t\tconnect to network device\n");
312 printf(" -e, --extract\t\textract raw crash report into separate '.crash' file\n"); 313 printf(" -e, --extract\t\textract raw crash report into separate '.crash' file\n");
313 printf(" -k, --keep\t\tcopy but do not remove crash reports from device\n"); 314 printf(" -k, --keep\t\tcopy but do not remove crash reports from device\n");
314 printf(" -d, --debug\t\tenable communication debugging\n"); 315 printf(" -d, --debug\t\tenable communication debugging\n");
@@ -331,6 +332,7 @@ int main(int argc, char* argv[])
331 332
332 int i; 333 int i;
333 const char* udid = NULL; 334 const char* udid = NULL;
335 int use_network = 0;
334 336
335#ifndef WIN32 337#ifndef WIN32
336 signal(SIGPIPE, SIG_IGN); 338 signal(SIGPIPE, SIG_IGN);
@@ -350,6 +352,10 @@ int main(int argc, char* argv[])
350 udid = argv[i]; 352 udid = argv[i];
351 continue; 353 continue;
352 } 354 }
355 else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
356 use_network = 1;
357 continue;
358 }
353 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { 359 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
354 print_usage(argc, argv); 360 print_usage(argc, argv);
355 return 0; 361 return 0;
@@ -389,12 +395,12 @@ int main(int argc, char* argv[])
389 return 0; 395 return 0;
390 } 396 }
391 397
392 device_error = idevice_new(&device, udid); 398 device_error = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX);
393 if (device_error != IDEVICE_E_SUCCESS) { 399 if (device_error != IDEVICE_E_SUCCESS) {
394 if (udid) { 400 if (udid) {
395 printf("No device found with udid %s, is it plugged in?\n", udid); 401 printf("No device found with udid %s.\n", udid);
396 } else { 402 } else {
397 printf("No device found, is it plugged in?\n"); 403 printf("No device found.\n");
398 } 404 }
399 return -1; 405 return -1;
400 } 406 }
diff --git a/tools/idevicedate.c b/tools/idevicedate.c
index e1fbc20..a9d78c1 100644
--- a/tools/idevicedate.c
+++ b/tools/idevicedate.c
@@ -59,6 +59,7 @@ static void print_usage(int argc, char **argv)
59 printf("\n"); 59 printf("\n");
60 printf("OPTIONS:\n"); 60 printf("OPTIONS:\n");
61 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 61 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
62 printf(" -n, --network\t\tconnect to network device\n");
62 printf(" -s, --set TIMESTAMP\tset UTC time described by TIMESTAMP\n"); 63 printf(" -s, --set TIMESTAMP\tset UTC time described by TIMESTAMP\n");
63 printf(" -c, --sync\t\tset time of device to current system time\n"); 64 printf(" -c, --sync\t\tset time of device to current system time\n");
64 printf(" -d, --debug\t\tenable communication debugging\n"); 65 printf(" -d, --debug\t\tenable communication debugging\n");
@@ -77,6 +78,7 @@ int main(int argc, char *argv[])
77 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; 78 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
78 int i; 79 int i;
79 const char* udid = NULL; 80 const char* udid = NULL;
81 int use_network = 0;
80 time_t setdate = 0; 82 time_t setdate = 0;
81 plist_t node = NULL; 83 plist_t node = NULL;
82 int node_type = -1; 84 int node_type = -1;
@@ -104,6 +106,10 @@ int main(int argc, char *argv[])
104 udid = argv[i]; 106 udid = argv[i];
105 continue; 107 continue;
106 } 108 }
109 else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
110 use_network = 1;
111 continue;
112 }
107 else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--set")) { 113 else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--set")) {
108 i++; 114 i++;
109 if (!argv[i] || (strlen(argv[i]) <= 1)) { 115 if (!argv[i] || (strlen(argv[i]) <= 1)) {
@@ -142,12 +148,12 @@ int main(int argc, char *argv[])
142 } 148 }
143 } 149 }
144 150
145 ret = idevice_new(&device, udid); 151 ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX);
146 if (ret != IDEVICE_E_SUCCESS) { 152 if (ret != IDEVICE_E_SUCCESS) {
147 if (udid) { 153 if (udid) {
148 printf("No device found with udid %s, is it plugged in?\n", udid); 154 printf("No device found with udid %s.\n", udid);
149 } else { 155 } else {
150 printf("No device found, is it plugged in?\n"); 156 printf("No device found.\n");
151 } 157 }
152 return -1; 158 return -1;
153 } 159 }
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index 66e997d..83a70a4 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -196,6 +196,7 @@ static void print_usage(int argc, char **argv)
196 printf("\n"); 196 printf("\n");
197 printf("The following OPTIONS are accepted:\n"); 197 printf("The following OPTIONS are accepted:\n");
198 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 198 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
199 printf(" -n, --network\t\tconnect to network device\n");
199 printf(" -e, --env NAME=VALUE\tset environment variable NAME to VALUE\n"); 200 printf(" -e, --env NAME=VALUE\tset environment variable NAME to VALUE\n");
200 printf(" -d, --debug\t\tenable communication debugging\n"); 201 printf(" -d, --debug\t\tenable communication debugging\n");
201 printf(" -h, --help\t\tprints usage information\n"); 202 printf(" -h, --help\t\tprints usage information\n");
@@ -215,6 +216,7 @@ int main(int argc, char *argv[])
215 int i; 216 int i;
216 int cmd = CMD_NONE; 217 int cmd = CMD_NONE;
217 const char* udid = NULL; 218 const char* udid = NULL;
219 int use_network = 0;
218 const char* bundle_identifier = NULL; 220 const char* bundle_identifier = NULL;
219 char* path = NULL; 221 char* path = NULL;
220 char* working_directory = NULL; 222 char* working_directory = NULL;
@@ -249,6 +251,9 @@ int main(int argc, char *argv[])
249 } 251 }
250 udid = argv[i]; 252 udid = argv[i];
251 continue; 253 continue;
254 } else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
255 use_network = 1;
256 continue;
252 } else if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--env")) { 257 } else if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--env")) {
253 i++; 258 i++;
254 if (!argv[i] || (strlen(argv[i]) <= 1) || strchr(argv[i], '=') == NULL) { 259 if (!argv[i] || (strlen(argv[i]) <= 1) || strchr(argv[i], '=') == NULL) {
@@ -306,12 +311,12 @@ int main(int argc, char *argv[])
306 } 311 }
307 312
308 /* connect to the device */ 313 /* connect to the device */
309 ret = idevice_new(&device, udid); 314 ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX);
310 if (ret != IDEVICE_E_SUCCESS) { 315 if (ret != IDEVICE_E_SUCCESS) {
311 if (udid) { 316 if (udid) {
312 printf("No device found with udid %s, is it plugged in?\n", udid); 317 printf("No device found with udid %s.\n", udid);
313 } else { 318 } else {
314 printf("No device found, is it plugged in?\n"); 319 printf("No device found.\n");
315 } 320 }
316 goto cleanup; 321 goto cleanup;
317 } 322 }
diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c
index c0a0eff..1d8a23d 100644
--- a/tools/idevicedebugserverproxy.c
+++ b/tools/idevicedebugserverproxy.c
@@ -76,6 +76,7 @@ static void print_usage(int argc, char **argv)
76 printf("\n"); 76 printf("\n");
77 printf("OPTIONS:\n"); 77 printf("OPTIONS:\n");
78 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 78 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
79 printf(" -n, --network\t\tconnect to network device\n");
79 printf(" -d, --debug\t\tenable communication debugging\n"); 80 printf(" -d, --debug\t\tenable communication debugging\n");
80 printf(" -h, --help\t\tprints usage information\n"); 81 printf(" -h, --help\t\tprints usage information\n");
81 printf(" -v, --version\t\tprints version information\n"); 82 printf(" -v, --version\t\tprints version information\n");
@@ -250,6 +251,7 @@ int main(int argc, char *argv[])
250 idevice_t device = NULL; 251 idevice_t device = NULL;
251 thread_info_t *thread_list = NULL; 252 thread_info_t *thread_list = NULL;
252 const char* udid = NULL; 253 const char* udid = NULL;
254 int use_network = 0;
253 uint16_t local_port = 0; 255 uint16_t local_port = 0;
254 int server_fd; 256 int server_fd;
255 int result = EXIT_SUCCESS; 257 int result = EXIT_SUCCESS;
@@ -294,6 +296,10 @@ int main(int argc, char *argv[])
294 udid = argv[i]; 296 udid = argv[i];
295 continue; 297 continue;
296 } 298 }
299 else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
300 use_network = 1;
301 continue;
302 }
297 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { 303 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
298 print_usage(argc, argv); 304 print_usage(argc, argv);
299 return EXIT_SUCCESS; 305 return EXIT_SUCCESS;
@@ -320,12 +326,12 @@ int main(int argc, char *argv[])
320 } 326 }
321 327
322 /* start services and connect to device */ 328 /* start services and connect to device */
323 ret = idevice_new(&device, udid); 329 ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX);
324 if (ret != IDEVICE_E_SUCCESS) { 330 if (ret != IDEVICE_E_SUCCESS) {
325 if (udid) { 331 if (udid) {
326 fprintf(stderr, "No device found with udid %s, is it plugged in?\n", udid); 332 fprintf(stderr, "No device found with udid %s.\n", udid);
327 } else { 333 } else {
328 fprintf(stderr, "No device found, is it plugged in?\n"); 334 fprintf(stderr, "No device found.\n");
329 } 335 }
330 result = EXIT_FAILURE; 336 result = EXIT_FAILURE;
331 goto leave_cleanup; 337 goto leave_cleanup;
diff --git a/tools/idevicediagnostics.c b/tools/idevicediagnostics.c
index 153f9ac..0e3e66e 100644
--- a/tools/idevicediagnostics.c
+++ b/tools/idevicediagnostics.c
@@ -71,6 +71,7 @@ int main(int argc, char **argv)
71 int result = EXIT_FAILURE; 71 int result = EXIT_FAILURE;
72 int i; 72 int i;
73 const char *udid = NULL; 73 const char *udid = NULL;
74 int use_network = 0;
74 int cmd = CMD_NONE; 75 int cmd = CMD_NONE;
75 char* cmd_arg = NULL; 76 char* cmd_arg = NULL;
76 plist_t node = NULL; 77 plist_t node = NULL;
@@ -95,6 +96,10 @@ int main(int argc, char **argv)
95 udid = argv[i]; 96 udid = argv[i];
96 continue; 97 continue;
97 } 98 }
99 else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
100 use_network = 1;
101 continue;
102 }
98 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { 103 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
99 print_usage(argc, argv); 104 print_usage(argc, argv);
100 result = EXIT_SUCCESS; 105 result = EXIT_SUCCESS;
@@ -191,11 +196,11 @@ int main(int argc, char **argv)
191 goto cleanup; 196 goto cleanup;
192 } 197 }
193 198
194 if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { 199 if (IDEVICE_E_SUCCESS != idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX)) {
195 if (udid) { 200 if (udid) {
196 printf("No device found with udid %s, is it plugged in?\n", udid); 201 printf("No device found with udid %s.\n", udid);
197 } else { 202 } else {
198 printf("No device found, is it plugged in?\n"); 203 printf("No device found.\n");
199 } 204 }
200 goto cleanup; 205 goto cleanup;
201 } 206 }
@@ -335,6 +340,7 @@ void print_usage(int argc, char **argv)
335 printf("\n"); 340 printf("\n");
336 printf("The following OPTIONS are accepted:\n"); 341 printf("The following OPTIONS are accepted:\n");
337 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 342 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
343 printf(" -n, --network\t\tconnect to network device\n");
338 printf(" -d, --debug\t\tenable communication debugging\n"); 344 printf(" -d, --debug\t\tenable communication debugging\n");
339 printf(" -h, --help\t\tprints usage information\n"); 345 printf(" -h, --help\t\tprints usage information\n");
340 printf(" -v, --version\t\tprints version information\n"); 346 printf(" -v, --version\t\tprints version information\n");
diff --git a/tools/ideviceenterrecovery.c b/tools/ideviceenterrecovery.c
index 8d82929..822c10a 100644
--- a/tools/ideviceenterrecovery.c
+++ b/tools/ideviceenterrecovery.c
@@ -91,7 +91,7 @@ int main(int argc, char *argv[])
91 91
92 ret = idevice_new(&device, udid); 92 ret = idevice_new(&device, udid);
93 if (ret != IDEVICE_E_SUCCESS) { 93 if (ret != IDEVICE_E_SUCCESS) {
94 printf("No device found with udid %s, is it plugged in?\n", udid); 94 printf("No device found with udid %s.\n", udid);
95 return -1; 95 return -1;
96 } 96 }
97 97
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c
index df43d5a..c89ddd3 100644
--- a/tools/ideviceimagemounter.c
+++ b/tools/ideviceimagemounter.c
@@ -49,6 +49,7 @@
49#include "common/utils.h" 49#include "common/utils.h"
50 50
51static int list_mode = 0; 51static int list_mode = 0;
52static int use_network = 0;
52static int xml_mode = 0; 53static int xml_mode = 0;
53static char *udid = NULL; 54static char *udid = NULL;
54static char *imagetype = NULL; 55static char *imagetype = NULL;
@@ -72,6 +73,7 @@ static void print_usage(int argc, char **argv)
72 printf("\n"); 73 printf("\n");
73 printf("OPTIONS:\n"); 74 printf("OPTIONS:\n");
74 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 75 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
76 printf(" -n, --network\t\tconnect to network device\n");
75 printf(" -l, --list\t\tList mount information\n"); 77 printf(" -l, --list\t\tList mount information\n");
76 printf(" -t, --imagetype\tImage type to use, default is 'Developer'\n"); 78 printf(" -t, --imagetype\tImage type to use, default is 'Developer'\n");
77 printf(" -x, --xml\t\tUse XML output\n"); 79 printf(" -x, --xml\t\tUse XML output\n");
@@ -86,19 +88,20 @@ static void print_usage(int argc, char **argv)
86static void parse_opts(int argc, char **argv) 88static void parse_opts(int argc, char **argv)
87{ 89{
88 static struct option longopts[] = { 90 static struct option longopts[] = {
89 { "help", no_argument, NULL, 'h'}, 91 { "help", no_argument, NULL, 'h' },
90 { "udid", required_argument, NULL, 'u'}, 92 { "udid", required_argument, NULL, 'u' },
91 { "list", no_argument, NULL, 'l'}, 93 { "network", no_argument, NULL, 'n' },
92 { "imagetype", required_argument, NULL, 't'}, 94 { "list", no_argument, NULL, 'l' },
93 { "xml", no_argument, NULL, 'x'}, 95 { "imagetype", required_argument, NULL, 't' },
94 { "debug", no_argument, NULL, 'd'}, 96 { "xml", no_argument, NULL, 'x' },
97 { "debug", no_argument, NULL, 'd' },
95 { "version", no_argument, NULL, 'v' }, 98 { "version", no_argument, NULL, 'v' },
96 { NULL, 0, NULL, 0 } 99 { NULL, 0, NULL, 0 }
97 }; 100 };
98 int c; 101 int c;
99 102
100 while (1) { 103 while (1) {
101 c = getopt_long(argc, argv, "hu:lt:xdv", longopts, NULL); 104 c = getopt_long(argc, argv, "hu:lt:xdnv", longopts, NULL);
102 if (c == -1) { 105 if (c == -1) {
103 break; 106 break;
104 } 107 }
@@ -116,6 +119,9 @@ static void parse_opts(int argc, char **argv)
116 free(udid); 119 free(udid);
117 udid = strdup(optarg); 120 udid = strdup(optarg);
118 break; 121 break;
122 case 'n':
123 use_network = 1;
124 break;
119 case 'l': 125 case 'l':
120 list_mode = 1; 126 list_mode = 1;
121 break; 127 break;
@@ -191,8 +197,12 @@ int main(int argc, char **argv)
191 } 197 }
192 } 198 }
193 199
194 if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { 200 if (IDEVICE_E_SUCCESS != idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX)) {
195 printf("No device found, is it plugged in?\n"); 201 if (udid) {
202 printf("No device found with udid %s.\n", udid);
203 } else {
204 printf("No device found.\n");
205 }
196 return -1; 206 return -1;
197 } 207 }
198 208
diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c
index 9b13ab8..a222e69 100644
--- a/tools/ideviceinfo.c
+++ b/tools/ideviceinfo.c
@@ -100,7 +100,7 @@ static void print_usage(int argc, char **argv, int is_error)
100 "\n" \ 100 "\n" \
101 "OPTIONS:\n" \ 101 "OPTIONS:\n" \
102 " -u, --udid UDID target specific device by UDID\n" \ 102 " -u, --udid UDID target specific device by UDID\n" \
103 " -n, --network connect to network device even if available via USB\n" \ 103 " -n, --network connect to network device\n" \
104 " -s, --simple use a simple connection to avoid auto-pairing with the device\n" \ 104 " -s, --simple use a simple connection to avoid auto-pairing with the device\n" \
105 " -q, --domain NAME set domain of query to NAME. Default: None\n" \ 105 " -q, --domain NAME set domain of query to NAME. Default: None\n" \
106 " -k, --key NAME only query key specified by NAME. Default: All keys.\n" \ 106 " -k, --key NAME only query key specified by NAME. Default: All keys.\n" \
@@ -130,12 +130,12 @@ int main(int argc, char *argv[])
130 int simple = 0; 130 int simple = 0;
131 int format = FORMAT_KEY_VALUE; 131 int format = FORMAT_KEY_VALUE;
132 char* udid = NULL; 132 char* udid = NULL;
133 int use_network = 0;
133 char *domain = NULL; 134 char *domain = NULL;
134 char *key = NULL; 135 char *key = NULL;
135 char *xml_doc = NULL; 136 char *xml_doc = NULL;
136 uint32_t xml_length; 137 uint32_t xml_length;
137 plist_t node = NULL; 138 plist_t node = NULL;
138 enum idevice_options lookup_opts = IDEVICE_LOOKUP_USBMUX | IDEVICE_LOOKUP_NETWORK;
139 139
140 int c = 0; 140 int c = 0;
141 const struct option longopts[] = { 141 const struct option longopts[] = {
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
170 udid = strdup(optarg); 170 udid = strdup(optarg);
171 break; 171 break;
172 case 'n': 172 case 'n':
173 lookup_opts |= IDEVICE_LOOKUP_PREFER_NETWORK; 173 use_network = 1;
174 break; 174 break;
175 case 'q': 175 case 'q':
176 if (!*optarg) { 176 if (!*optarg) {
@@ -211,7 +211,7 @@ int main(int argc, char *argv[])
211 argc -= optind; 211 argc -= optind;
212 argv += optind; 212 argv += optind;
213 213
214 ret = idevice_new_with_options(&device, udid, lookup_opts); 214 ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX);
215 if (ret != IDEVICE_E_SUCCESS) { 215 if (ret != IDEVICE_E_SUCCESS) {
216 if (udid) { 216 if (udid) {
217 printf("ERROR: Device %s not found!\n", udid); 217 printf("ERROR: Device %s not found!\n", udid);
diff --git a/tools/idevicename.c b/tools/idevicename.c
index 5a34ea0..a87872b 100644
--- a/tools/idevicename.c
+++ b/tools/idevicename.c
@@ -44,8 +44,9 @@ static void print_usage(void)
44 printf("Display the device name or set it to NAME if specified.\n"); 44 printf("Display the device name or set it to NAME if specified.\n");
45 printf("\n"); 45 printf("\n");
46 printf("OPTIONS:\n"); 46 printf("OPTIONS:\n");
47 printf(" -d, --debug\t\tenable communication debugging\n");
48 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 47 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
48 printf(" -n, --network\t\tconnect to network device\n");
49 printf(" -d, --debug\t\tenable communication debugging\n");
49 printf(" -h, --help\t\tprint usage information\n"); 50 printf(" -h, --help\t\tprint usage information\n");
50 printf(" -v, --version\t\tprint version information\n"); 51 printf(" -v, --version\t\tprint version information\n");
51 printf("\n"); 52 printf("\n");
@@ -58,6 +59,7 @@ int main(int argc, char** argv)
58 int c = 0; 59 int c = 0;
59 const struct option longopts[] = { 60 const struct option longopts[] = {
60 { "udid", required_argument, NULL, 'u' }, 61 { "udid", required_argument, NULL, 'u' },
62 { "network", no_argument, NULL, 'n' },
61 { "debug", no_argument, NULL, 'd' }, 63 { "debug", no_argument, NULL, 'd' },
62 { "help", no_argument, NULL, 'h' }, 64 { "help", no_argument, NULL, 'h' },
63 { "version", no_argument, NULL, 'v' }, 65 { "version", no_argument, NULL, 'v' },
@@ -65,12 +67,13 @@ int main(int argc, char** argv)
65 }; 67 };
66 int res = -1; 68 int res = -1;
67 char* udid = NULL; 69 char* udid = NULL;
70 int use_network = 0;
68 71
69#ifndef WIN32 72#ifndef WIN32
70 signal(SIGPIPE, SIG_IGN); 73 signal(SIGPIPE, SIG_IGN);
71#endif 74#endif
72 75
73 while ((c = getopt_long(argc, argv, "du:hv", longopts, NULL)) != -1) { 76 while ((c = getopt_long(argc, argv, "du:hnv", longopts, NULL)) != -1) {
74 switch (c) { 77 switch (c) {
75 case 'u': 78 case 'u':
76 if (!*optarg) { 79 if (!*optarg) {
@@ -81,6 +84,9 @@ int main(int argc, char** argv)
81 free(udid); 84 free(udid);
82 udid = strdup(optarg); 85 udid = strdup(optarg);
83 break; 86 break;
87 case 'n':
88 use_network = 1;
89 break;
84 case 'h': 90 case 'h':
85 print_usage(); 91 print_usage();
86 return 0; 92 return 0;
@@ -105,8 +111,12 @@ int main(int argc, char** argv)
105 } 111 }
106 112
107 idevice_t device = NULL; 113 idevice_t device = NULL;
108 if (idevice_new(&device, udid) != IDEVICE_E_SUCCESS) { 114 if (idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX) != IDEVICE_E_SUCCESS) {
109 fprintf(stderr, "ERROR: Could not connect to device\n"); 115 if (udid) {
116 fprintf(stderr, "ERROR: No device found with udid %s.\n", udid);
117 } else {
118 fprintf(stderr, "ERROR: No device found.\n");
119 }
110 return -1; 120 return -1;
111 } 121 }
112 122
diff --git a/tools/idevicenotificationproxy.c b/tools/idevicenotificationproxy.c
index 15b63a3..cfc9260 100644
--- a/tools/idevicenotificationproxy.c
+++ b/tools/idevicenotificationproxy.c
@@ -74,6 +74,7 @@ static void print_usage(int argc, char **argv)
74 printf("\n"); 74 printf("\n");
75 printf("The following OPTIONS are accepted:\n"); 75 printf("The following OPTIONS are accepted:\n");
76 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 76 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
77 printf(" -n, --network\t\tconnect to network device\n");
77 printf(" -d, --debug\t\tenable communication debugging\n"); 78 printf(" -d, --debug\t\tenable communication debugging\n");
78 printf(" -h, --help\t\tprints usage information\n"); 79 printf(" -h, --help\t\tprints usage information\n");
79 printf(" -v, --version\t\tprints version information\n"); 80 printf(" -v, --version\t\tprints version information\n");
@@ -98,6 +99,7 @@ int main(int argc, char *argv[])
98 int result = -1; 99 int result = -1;
99 int i; 100 int i;
100 const char* udid = NULL; 101 const char* udid = NULL;
102 int use_network = 0;
101 int cmd = CMD_NONE; 103 int cmd = CMD_NONE;
102 char* cmd_arg = NULL; 104 char* cmd_arg = NULL;
103 105
@@ -133,6 +135,10 @@ int main(int argc, char *argv[])
133 result = 0; 135 result = 0;
134 goto cleanup; 136 goto cleanup;
135 } 137 }
138 else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
139 use_network = 1;
140 continue;
141 }
136 else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) { 142 else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
137 printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION); 143 printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
138 result = 0; 144 result = 0;
@@ -185,11 +191,11 @@ int main(int argc, char *argv[])
185 goto cleanup; 191 goto cleanup;
186 } 192 }
187 193
188 if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { 194 if (IDEVICE_E_SUCCESS != idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX)) {
189 if (udid) { 195 if (udid) {
190 printf("No device found with udid %s, is it plugged in?\n", udid); 196 printf("No device found with udid %s.\n", udid);
191 } else { 197 } else {
192 printf("No device found, is it plugged in?\n"); 198 printf("No device found.\n");
193 } 199 }
194 goto cleanup; 200 goto cleanup;
195 } 201 }
diff --git a/tools/idevicepair.c b/tools/idevicepair.c
index de631a0..68507f4 100644
--- a/tools/idevicepair.c
+++ b/tools/idevicepair.c
@@ -202,30 +202,25 @@ int main(int argc, char **argv)
202 return EXIT_SUCCESS; 202 return EXIT_SUCCESS;
203 } 203 }
204 204
205 if (udid) { 205 ret = idevice_new(&device, udid);
206 ret = idevice_new(&device, udid); 206 if (ret != IDEVICE_E_SUCCESS) {
207 if (ret != IDEVICE_E_SUCCESS) { 207 if (udid) {
208 printf("No device found with udid %s, is it plugged in?\n", udid); 208 printf("No device found with udid %s.\n", udid);
209 free(udid); 209 } else {
210 return EXIT_FAILURE; 210 printf("No device found.\n");
211 } 211 }
212 free(udid); 212 free(udid);
213 udid = NULL; 213 return EXIT_FAILURE;
214 } else { 214 }
215 ret = idevice_new(&device, NULL); 215 if (!udid) {
216 ret = idevice_get_udid(device, &udid);
216 if (ret != IDEVICE_E_SUCCESS) { 217 if (ret != IDEVICE_E_SUCCESS) {
217 printf("No device found, is it plugged in?\n"); 218 printf("ERROR: Could not get device udid, error code %d\n", ret);
218 return EXIT_FAILURE; 219 result = EXIT_FAILURE;
220 goto leave;
219 } 221 }
220 } 222 }
221 223
222 ret = idevice_get_udid(device, &udid);
223 if (ret != IDEVICE_E_SUCCESS) {
224 printf("ERROR: Could not get device udid, error code %d\n", ret);
225 result = EXIT_FAILURE;
226 goto leave;
227 }
228
229 if (op == OP_HOSTID) { 224 if (op == OP_HOSTID) {
230 plist_t pair_record = NULL; 225 plist_t pair_record = NULL;
231 char *hostid = NULL; 226 char *hostid = NULL;
@@ -244,7 +239,7 @@ int main(int argc, char **argv)
244 return EXIT_SUCCESS; 239 return EXIT_SUCCESS;
245 } 240 }
246 241
247 lerr = lockdownd_client_new(device, &client, "idevicepair"); 242 lerr = lockdownd_client_new(device, &client, TOOL_NAME);
248 if (lerr != LOCKDOWN_E_SUCCESS) { 243 if (lerr != LOCKDOWN_E_SUCCESS) {
249 idevice_free(device); 244 idevice_free(device);
250 printf("ERROR: Could not connect to lockdownd, error code %d\n", lerr); 245 printf("ERROR: Could not connect to lockdownd, error code %d\n", lerr);
diff --git a/tools/ideviceprovision.c b/tools/ideviceprovision.c
index 8cf3de6..c93a682 100644
--- a/tools/ideviceprovision.c
+++ b/tools/ideviceprovision.c
@@ -72,6 +72,7 @@ static void print_usage(int argc, char **argv)
72 printf("\n"); 72 printf("\n");
73 printf("The following OPTIONS are accepted:\n"); 73 printf("The following OPTIONS are accepted:\n");
74 printf(" -u, --udid UDID target specific device by UDID\n"); 74 printf(" -u, --udid UDID target specific device by UDID\n");
75 printf(" -n, --network connect to network device\n");
75 printf(" -x, --xml print XML output when using the 'dump' command\n"); 76 printf(" -x, --xml print XML output when using the 'dump' command\n");
76 printf(" -d, --debug enable communication debugging\n"); 77 printf(" -d, --debug enable communication debugging\n");
77 printf(" -h, --help prints usage information\n"); 78 printf(" -h, --help prints usage information\n");
@@ -300,6 +301,7 @@ int main(int argc, char *argv[])
300 const char* udid = NULL; 301 const char* udid = NULL;
301 const char* param = NULL; 302 const char* param = NULL;
302 const char* param2 = NULL; 303 const char* param2 = NULL;
304 int use_network = 0;
303 305
304#ifndef WIN32 306#ifndef WIN32
305 signal(SIGPIPE, SIG_IGN); 307 signal(SIGPIPE, SIG_IGN);
@@ -319,6 +321,10 @@ int main(int argc, char *argv[])
319 udid = argv[i]; 321 udid = argv[i];
320 continue; 322 continue;
321 } 323 }
324 else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
325 use_network = 1;
326 continue;
327 }
322 else if (!strcmp(argv[i], "install")) { 328 else if (!strcmp(argv[i], "install")) {
323 i++; 329 i++;
324 if (!argv[i] || (strlen(argv[i]) < 1)) { 330 if (!argv[i] || (strlen(argv[i]) < 1)) {
@@ -437,12 +443,12 @@ int main(int argc, char *argv[])
437 } 443 }
438 } 444 }
439 445
440 ret = idevice_new(&device, udid); 446 ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX);
441 if (ret != IDEVICE_E_SUCCESS) { 447 if (ret != IDEVICE_E_SUCCESS) {
442 if (udid) { 448 if (udid) {
443 printf("No device found with udid %s, is it plugged in?\n", udid); 449 printf("No device found with udid %s.\n", udid);
444 } else { 450 } else {
445 printf("No device found, is it plugged in?\n"); 451 printf("No device found.\n");
446 } 452 }
447 return -1; 453 return -1;
448 } 454 }
diff --git a/tools/idevicescreenshot.c b/tools/idevicescreenshot.c
index c9dc0ef..75a69ce 100644
--- a/tools/idevicescreenshot.c
+++ b/tools/idevicescreenshot.c
@@ -50,6 +50,7 @@ int main(int argc, char **argv)
50 int result = -1; 50 int result = -1;
51 int i; 51 int i;
52 const char *udid = NULL; 52 const char *udid = NULL;
53 int use_network = 0;
53 char *filename = NULL; 54 char *filename = NULL;
54 55
55#ifndef WIN32 56#ifndef WIN32
@@ -70,6 +71,10 @@ int main(int argc, char **argv)
70 udid = argv[i]; 71 udid = argv[i];
71 continue; 72 continue;
72 } 73 }
74 else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
75 use_network = 1;
76 continue;
77 }
73 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { 78 else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
74 print_usage(argc, argv); 79 print_usage(argc, argv);
75 return 0; 80 return 0;
@@ -88,11 +93,11 @@ int main(int argc, char **argv)
88 } 93 }
89 } 94 }
90 95
91 if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { 96 if (IDEVICE_E_SUCCESS != idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX)) {
92 if (udid) { 97 if (udid) {
93 printf("No device found with udid %s, is it plugged in?\n", udid); 98 printf("No device found with udid %s.\n", udid);
94 } else { 99 } else {
95 printf("No device found, is it plugged in?\n"); 100 printf("No device found.\n");
96 } 101 }
97 return -1; 102 return -1;
98 } 103 }
@@ -174,6 +179,7 @@ void print_usage(int argc, char **argv)
174 printf("the screenshotr service is not available.\n"); 179 printf("the screenshotr service is not available.\n");
175 printf("\n"); 180 printf("\n");
176 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 181 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
182 printf(" -n, --network\t\tconnect to network device\n");
177 printf(" -d, --debug\t\tenable communication debugging\n"); 183 printf(" -d, --debug\t\tenable communication debugging\n");
178 printf(" -h, --help\t\tprints usage information\n"); 184 printf(" -h, --help\t\tprints usage information\n");
179 printf(" -v, --version\t\tprints version information\n"); 185 printf(" -v, --version\t\tprints version information\n");
diff --git a/tools/idevicesetlocation.c b/tools/idevicesetlocation.c
index 47f15ca..6332e3c 100644
--- a/tools/idevicesetlocation.c
+++ b/tools/idevicesetlocation.c
@@ -54,7 +54,7 @@ static void print_usage(int argc, char **argv, int is_error)
54 fprintf(is_error ? stderr : stdout, "\n" \ 54 fprintf(is_error ? stderr : stdout, "\n" \
55 "OPTIONS:\n" \ 55 "OPTIONS:\n" \
56 " -u, --udid UDID target specific device by UDID\n" \ 56 " -u, --udid UDID target specific device by UDID\n" \
57 " -n, --network connect to network device even if available via USB\n" \ 57 " -n, --network connect to network device\n" \
58 " -d, --debug enable communication debugging\n" \ 58 " -d, --debug enable communication debugging\n" \
59 " -h, --help prints usage information\n" \ 59 " -h, --help prints usage information\n" \
60 " -v, --version prints version information\n" \ 60 " -v, --version prints version information\n" \
@@ -77,7 +77,7 @@ int main(int argc, char **argv)
77 }; 77 };
78 uint32_t mode = 0; 78 uint32_t mode = 0;
79 char *udid = NULL; 79 char *udid = NULL;
80 enum idevice_options lookup_opts = IDEVICE_LOOKUP_USBMUX | IDEVICE_LOOKUP_NETWORK; 80 int use_network = 0;
81 81
82 while ((c = getopt_long(argc, argv, "dhu:nv", longopts, NULL)) != -1) { 82 while ((c = getopt_long(argc, argv, "dhu:nv", longopts, NULL)) != -1) {
83 switch (c) { 83 switch (c) {
@@ -94,7 +94,7 @@ int main(int argc, char **argv)
94 udid = strdup(optarg); 94 udid = strdup(optarg);
95 break; 95 break;
96 case 'n': 96 case 'n':
97 lookup_opts |= IDEVICE_LOOKUP_PREFER_NETWORK; 97 use_network = 1;
98 break; 98 break;
99 case 'h': 99 case 'h':
100 print_usage(argc, argv, 0); 100 print_usage(argc, argv, 0);
@@ -129,7 +129,7 @@ int main(int argc, char **argv)
129 129
130 idevice_t device = NULL; 130 idevice_t device = NULL;
131 131
132 if (idevice_new_with_options(&device, udid, lookup_opts) != IDEVICE_E_SUCCESS) { 132 if (idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX) != IDEVICE_E_SUCCESS) {
133 if (udid) { 133 if (udid) {
134 printf("ERROR: Device %s not found!\n", udid); 134 printf("ERROR: Device %s not found!\n", udid);
135 } else { 135 } else {
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c
index acbcd74..0eed138 100644
--- a/tools/idevicesyslog.c
+++ b/tools/idevicesyslog.c
@@ -69,7 +69,7 @@ static syslog_relay_client_t syslog = NULL;
69 69
70static const char QUIET_FILTER[] = "CircleJoinRequested|CommCenter|HeuristicInterpreter|MobileMail|PowerUIAgent|ProtectedCloudKeySyncing|SpringBoard|UserEventAgent|WirelessRadioManagerd|accessoryd|accountsd|aggregated|analyticsd|appstored|apsd|assetsd|assistant_service|backboardd|biometrickitd|bluetoothd|calaccessd|callservicesd|cloudd|com.apple.Safari.SafeBrowsing.Service|contextstored|corecaptured|coreduetd|corespeechd|cdpd|dasd|dataaccessd|distnoted|dprivacyd|duetexpertd|findmydeviced|fmfd|fmflocatord|gpsd|healthd|homed|identityservicesd|imagent|itunescloudd|itunesstored|kernel|locationd|maild|mDNSResponder|mediaremoted|mediaserverd|mobileassetd|nanoregistryd|nanotimekitcompaniond|navd|nsurlsessiond|passd|pasted|photoanalysisd|powerd|powerlogHelperd|ptpd|rapportd|remindd|routined|runningboardd|searchd|sharingd|suggestd|symptomsd|timed|thermalmonitord|useractivityd|vmd|wifid|wirelessproxd"; 70static const char QUIET_FILTER[] = "CircleJoinRequested|CommCenter|HeuristicInterpreter|MobileMail|PowerUIAgent|ProtectedCloudKeySyncing|SpringBoard|UserEventAgent|WirelessRadioManagerd|accessoryd|accountsd|aggregated|analyticsd|appstored|apsd|assetsd|assistant_service|backboardd|biometrickitd|bluetoothd|calaccessd|callservicesd|cloudd|com.apple.Safari.SafeBrowsing.Service|contextstored|corecaptured|coreduetd|corespeechd|cdpd|dasd|dataaccessd|distnoted|dprivacyd|duetexpertd|findmydeviced|fmfd|fmflocatord|gpsd|healthd|homed|identityservicesd|imagent|itunescloudd|itunesstored|kernel|locationd|maild|mDNSResponder|mediaremoted|mediaserverd|mobileassetd|nanoregistryd|nanotimekitcompaniond|navd|nsurlsessiond|passd|pasted|photoanalysisd|powerd|powerlogHelperd|ptpd|rapportd|remindd|routined|runningboardd|searchd|sharingd|suggestd|symptomsd|timed|thermalmonitord|useractivityd|vmd|wifid|wirelessproxd";
71 71
72enum idevice_options lookup_opts = IDEVICE_LOOKUP_USBMUX | IDEVICE_LOOKUP_NETWORK; 72static int use_network = 0;
73 73
74static char *line = NULL; 74static char *line = NULL;
75static int line_buffer_size = 0; 75static int line_buffer_size = 0;
@@ -403,7 +403,7 @@ static void syslog_callback(char c, void *user_data)
403 403
404static int start_logging(void) 404static int start_logging(void)
405{ 405{
406 idevice_error_t ret = idevice_new_with_options(&device, udid, lookup_opts); 406 idevice_error_t ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX);
407 if (ret != IDEVICE_E_SUCCESS) { 407 if (ret != IDEVICE_E_SUCCESS) {
408 fprintf(stderr, "Device with udid %s not found!?\n", udid); 408 fprintf(stderr, "Device with udid %s not found!?\n", udid);
409 return -1; 409 return -1;
@@ -526,7 +526,7 @@ static void print_usage(int argc, char **argv, int is_error)
526 "\n" \ 526 "\n" \
527 "OPTIONS:\n" \ 527 "OPTIONS:\n" \
528 " -u, --udid UDID target specific device by UDID\n" \ 528 " -u, --udid UDID target specific device by UDID\n" \
529 " -n, --network connect to network device even if available via USB\n" \ 529 " -n, --network connect to network device\n" \
530 " -x, --exit exit when device disconnects\n" \ 530 " -x, --exit exit when device disconnects\n" \
531 " -h, --help prints usage information\n" \ 531 " -h, --help prints usage information\n" \
532 " -d, --debug enable communication debugging\n" \ 532 " -d, --debug enable communication debugging\n" \
@@ -610,7 +610,7 @@ int main(int argc, char *argv[])
610 udid = strdup(optarg); 610 udid = strdup(optarg);
611 break; 611 break;
612 case 'n': 612 case 'n':
613 lookup_opts |= IDEVICE_LOOKUP_PREFER_NETWORK; 613 use_network = 1;
614 break; 614 break;
615 case 'q': 615 case 'q':
616 exclude_filter++; 616 exclude_filter++;