summaryrefslogtreecommitdiffstats
path: root/src/ideviceinstaller.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2020-06-05 21:14:46 +0200
committerGravatar Nikias Bassen2020-06-05 21:14:46 +0200
commit7394006f188cd4c7edca39472c3b3f5f728dcfe6 (patch)
tree3acd63817a38aa5899720af763e9bdd465b21180 /src/ideviceinstaller.c
parent0a54292828827b99db6faa84a0820b2ab2094f1d (diff)
downloadideviceinstaller-7394006f188cd4c7edca39472c3b3f5f728dcfe6.tar.gz
ideviceinstaller-7394006f188cd4c7edca39472c3b3f5f728dcfe6.tar.bz2
Add --network option to support network devices
Diffstat (limited to 'src/ideviceinstaller.c')
-rw-r--r--src/ideviceinstaller.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c
index e109931..e45bb12 100644
--- a/src/ideviceinstaller.c
+++ b/src/ideviceinstaller.c
@@ -112,6 +112,7 @@ int cmd = CMD_NONE;
112 112
113char *last_status = NULL; 113char *last_status = NULL;
114int wait_for_command_complete = 0; 114int wait_for_command_complete = 0;
115int use_network = 0;
115int use_notifier = 0; 116int use_notifier = 0;
116int notification_expected = 0; 117int notification_expected = 0;
117int is_device_connected = 0; 118int is_device_connected = 0;
@@ -391,6 +392,7 @@ static void print_usage(int argc, char **argv)
391 printf( 392 printf(
392 "OPTIONS:\n" 393 "OPTIONS:\n"
393 " -u, --udid UDID\tTarget specific device by UDID.\n" 394 " -u, --udid UDID\tTarget specific device by UDID.\n"
395 " -n, --network\t\tConnect to network device.\n"
394 " -l, --list-apps\tList apps, possible options:\n" 396 " -l, --list-apps\tList apps, possible options:\n"
395 " -o list_user\t- list user apps only (this is the default)\n" 397 " -o list_user\t- list user apps only (this is the default)\n"
396 " -o list_system\t- list system apps only\n" 398 " -o list_system\t- list system apps only\n"
@@ -411,7 +413,7 @@ static void print_usage(int argc, char **argv)
411 " -r, --restore APPID\tRestore archived app specified by APPID\n" 413 " -r, --restore APPID\tRestore archived app specified by APPID\n"
412 " -R, --remove-archive APPID Remove app archive specified by APPID\n" 414 " -R, --remove-archive APPID Remove app archive specified by APPID\n"
413 " -o, --options\t\tPass additional options to the specified command.\n" 415 " -o, --options\t\tPass additional options to the specified command.\n"
414 " -n, --notify-wait\t\tWait for app installed/uninstalled notification\n" 416 " -w, --notify-wait\t\tWait for app installed/uninstalled notification\n"
415 " \t\tto before reporting success of operation\n" 417 " \t\tto before reporting success of operation\n"
416 " -h, --help\t\tprints usage information\n" 418 " -h, --help\t\tprints usage information\n"
417 " -d, --debug\t\tenable communication debugging\n" 419 " -d, --debug\t\tenable communication debugging\n"
@@ -427,6 +429,7 @@ static void parse_opts(int argc, char **argv)
427 static struct option longopts[] = { 429 static struct option longopts[] = {
428 { "help", no_argument, NULL, 'h' }, 430 { "help", no_argument, NULL, 'h' },
429 { "udid", required_argument, NULL, 'u' }, 431 { "udid", required_argument, NULL, 'u' },
432 { "network", no_argument, NULL, 'n' },
430 { "list-apps", no_argument, NULL, 'l' }, 433 { "list-apps", no_argument, NULL, 'l' },
431 { "install", required_argument, NULL, 'i' }, 434 { "install", required_argument, NULL, 'i' },
432 { "uninstall", required_argument, NULL, 'U' }, 435 { "uninstall", required_argument, NULL, 'U' },
@@ -436,7 +439,7 @@ static void parse_opts(int argc, char **argv)
436 { "restore", required_argument, NULL, 'r' }, 439 { "restore", required_argument, NULL, 'r' },
437 { "remove-archive", required_argument, NULL, 'R' }, 440 { "remove-archive", required_argument, NULL, 'R' },
438 { "options", required_argument, NULL, 'o' }, 441 { "options", required_argument, NULL, 'o' },
439 { "notify-wait", no_argument, NULL, 'n' }, 442 { "notify-wait", no_argument, NULL, 'w' },
440 { "debug", no_argument, NULL, 'd' }, 443 { "debug", no_argument, NULL, 'd' },
441 { "version", no_argument, NULL, 'v' }, 444 { "version", no_argument, NULL, 'v' },
442 { NULL, 0, NULL, 0 } 445 { NULL, 0, NULL, 0 }
@@ -444,7 +447,7 @@ static void parse_opts(int argc, char **argv)
444 int c; 447 int c;
445 448
446 while (1) { 449 while (1) {
447 c = getopt_long(argc, argv, "hU:li:u:g:La:r:R:o:ndv", longopts, 450 c = getopt_long(argc, argv, "hU:li:u:g:La:r:R:o:nwdv", longopts,
448 (int *) 0); 451 (int *) 0);
449 if (c == -1) { 452 if (c == -1) {
450 break; 453 break;
@@ -481,6 +484,9 @@ static void parse_opts(int argc, char **argv)
481 } 484 }
482 udid = strdup(optarg); 485 udid = strdup(optarg);
483 break; 486 break;
487 case 'n':
488 use_network = 1;
489 break;
484 case 'l': 490 case 'l':
485 cmd = CMD_LIST_APPS; 491 cmd = CMD_LIST_APPS;
486 break; 492 break;
@@ -523,7 +529,7 @@ static void parse_opts(int argc, char **argv)
523 options = newopts; 529 options = newopts;
524 } 530 }
525 break; 531 break;
526 case 'n': 532 case 'w':
527 use_notifier = 1; 533 use_notifier = 1;
528 break; 534 break;
529 case 'd': 535 case 'd':
@@ -663,8 +669,12 @@ int main(int argc, char **argv)
663 argc -= optind; 669 argc -= optind;
664 argv += optind; 670 argv += optind;
665 671
666 if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { 672 if (IDEVICE_E_SUCCESS != idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX)) {
667 fprintf(stderr, "No iOS device found, is it plugged in?\n"); 673 if (udid) {
674 fprintf(stderr, "No device found with udid %s.\n", udid);
675 } else {
676 fprintf(stderr, "No device found.\n");
677 }
668 return -1; 678 return -1;
669 } 679 }
670 680