summaryrefslogtreecommitdiffstats
path: root/tools/idevicedebugserverproxy.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/idevicedebugserverproxy.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/idevicedebugserverproxy.c')
-rw-r--r--tools/idevicedebugserverproxy.c12
1 files changed, 9 insertions, 3 deletions
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;