diff options
-rw-r--r-- | tools/idevicebackup.c | 26 | ||||
-rw-r--r-- | tools/idevicebackup2.c | 27 | ||||
-rw-r--r-- | tools/idevicecrashreport.c | 12 | ||||
-rw-r--r-- | tools/idevicedate.c | 12 | ||||
-rw-r--r-- | tools/idevicedebug.c | 11 | ||||
-rw-r--r-- | tools/idevicedebugserverproxy.c | 12 | ||||
-rw-r--r-- | tools/idevicediagnostics.c | 12 | ||||
-rw-r--r-- | tools/ideviceenterrecovery.c | 2 | ||||
-rw-r--r-- | tools/ideviceimagemounter.c | 28 | ||||
-rw-r--r-- | tools/ideviceinfo.c | 8 | ||||
-rw-r--r-- | tools/idevicename.c | 18 | ||||
-rw-r--r-- | tools/idevicenotificationproxy.c | 12 | ||||
-rw-r--r-- | tools/idevicepair.c | 33 | ||||
-rw-r--r-- | tools/ideviceprovision.c | 12 | ||||
-rw-r--r-- | tools/idevicescreenshot.c | 12 | ||||
-rw-r--r-- | tools/idevicesetlocation.c | 8 | ||||
-rw-r--r-- | tools/idevicesyslog.c | 8 |
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) printf("\n"); printf("OPTIONS:\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); + printf(" -n, --network\t\tconnect to network device\n"); printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -h, --help\t\tprints usage information\n"); printf(" -v, --version\t\tprints version information\n"); @@ -690,6 +691,7 @@ int main(int argc, char *argv[]) lockdownd_error_t ldret = LOCKDOWN_E_UNKNOWN_ERROR; int i; char* udid = NULL; + int use_network = 0; lockdownd_service_descriptor_t service = NULL; int cmd = -1; int is_full_backup = 0; @@ -729,6 +731,10 @@ int main(int argc, char *argv[]) udid = strdup(argv[i]); continue; } + else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { + use_network = 1; + continue; + } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { print_usage(argc, argv); return 0; @@ -783,20 +789,14 @@ int main(int argc, char *argv[]) printf("Backup directory is \"%s\"\n", backup_directory); - if (udid) { - ret = idevice_new(&device, udid); - if (ret != IDEVICE_E_SUCCESS) { - printf("No device found with udid %s, is it plugged in?\n", udid); - return -1; - } - } - else - { - ret = idevice_new(&device, NULL); - if (ret != IDEVICE_E_SUCCESS) { - printf("No device found, is it plugged in?\n"); - return -1; + ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); + if (ret != IDEVICE_E_SUCCESS) { + if (udid) { + printf("No device found with udid %s.\n", udid); + } else { + printf("No device found.\n"); } + return -1; } 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) printf("OPTIONS:\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); printf(" -s, --source UDID\tuse backup data from device specified by UDID\n"); + printf(" -n, --network\t\tconnect to network device\n"); printf(" -i, --interactive\trequest passwords interactively\n"); printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -h, --help\t\tprints usage information\n"); @@ -1449,6 +1450,7 @@ int main(int argc, char *argv[]) int i; char* udid = NULL; char* source_udid = NULL; + int use_network = 0; lockdownd_service_descriptor_t service = NULL; int cmd = -1; int cmd_flags = 0; @@ -1496,6 +1498,10 @@ int main(int argc, char *argv[]) source_udid = strdup(argv[i]); continue; } + else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { + use_network = 1; + continue; + } else if (!strcmp(argv[i], "-i") || !strcmp(argv[i], "--interactive")) { interactive_mode = 1; continue; @@ -1669,20 +1675,17 @@ int main(int argc, char *argv[]) } idevice_t device = NULL; - if (udid) { - ret = idevice_new(&device, udid); - if (ret != IDEVICE_E_SUCCESS) { - printf("No device found with udid %s, is it plugged in?\n", udid); - return -1; + ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); + if (ret != IDEVICE_E_SUCCESS) { + if (udid) { + printf("No device found with udid %s.\n", udid); + } else { + printf("No device found.\n"); } + return -1; } - else - { - ret = idevice_new(&device, NULL); - if (ret != IDEVICE_E_SUCCESS) { - printf("No device found, is it plugged in?\n"); - return -1; - } + + if (!udid) { idevice_get_udid(device, &udid); } 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) printf("\n"); printf("OPTIONS:\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); + printf(" -n, --network\t\tconnect to network device\n"); printf(" -e, --extract\t\textract raw crash report into separate '.crash' file\n"); printf(" -k, --keep\t\tcopy but do not remove crash reports from device\n"); printf(" -d, --debug\t\tenable communication debugging\n"); @@ -331,6 +332,7 @@ int main(int argc, char* argv[]) int i; const char* udid = NULL; + int use_network = 0; #ifndef WIN32 signal(SIGPIPE, SIG_IGN); @@ -350,6 +352,10 @@ int main(int argc, char* argv[]) udid = argv[i]; continue; } + else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { + use_network = 1; + continue; + } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { print_usage(argc, argv); return 0; @@ -389,12 +395,12 @@ int main(int argc, char* argv[]) return 0; } - device_error = idevice_new(&device, udid); + device_error = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); if (device_error != IDEVICE_E_SUCCESS) { if (udid) { - printf("No device found with udid %s, is it plugged in?\n", udid); + printf("No device found with udid %s.\n", udid); } else { - printf("No device found, is it plugged in?\n"); + printf("No device found.\n"); } return -1; } 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) printf("\n"); printf("OPTIONS:\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); + printf(" -n, --network\t\tconnect to network device\n"); printf(" -s, --set TIMESTAMP\tset UTC time described by TIMESTAMP\n"); printf(" -c, --sync\t\tset time of device to current system time\n"); printf(" -d, --debug\t\tenable communication debugging\n"); @@ -77,6 +78,7 @@ int main(int argc, char *argv[]) idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; int i; const char* udid = NULL; + int use_network = 0; time_t setdate = 0; plist_t node = NULL; int node_type = -1; @@ -104,6 +106,10 @@ int main(int argc, char *argv[]) udid = argv[i]; continue; } + else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { + use_network = 1; + continue; + } else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--set")) { i++; if (!argv[i] || (strlen(argv[i]) <= 1)) { @@ -142,12 +148,12 @@ int main(int argc, char *argv[]) } } - ret = idevice_new(&device, udid); + ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); if (ret != IDEVICE_E_SUCCESS) { if (udid) { - printf("No device found with udid %s, is it plugged in?\n", udid); + printf("No device found with udid %s.\n", udid); } else { - printf("No device found, is it plugged in?\n"); + printf("No device found.\n"); } return -1; } 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) printf("\n"); printf("The following OPTIONS are accepted:\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); + printf(" -n, --network\t\tconnect to network device\n"); printf(" -e, --env NAME=VALUE\tset environment variable NAME to VALUE\n"); printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -h, --help\t\tprints usage information\n"); @@ -215,6 +216,7 @@ int main(int argc, char *argv[]) int i; int cmd = CMD_NONE; const char* udid = NULL; + int use_network = 0; const char* bundle_identifier = NULL; char* path = NULL; char* working_directory = NULL; @@ -249,6 +251,9 @@ int main(int argc, char *argv[]) } udid = argv[i]; continue; + } else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { + use_network = 1; + continue; } else if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--env")) { i++; if (!argv[i] || (strlen(argv[i]) <= 1) || strchr(argv[i], '=') == NULL) { @@ -306,12 +311,12 @@ int main(int argc, char *argv[]) } /* connect to the device */ - ret = idevice_new(&device, udid); + ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); if (ret != IDEVICE_E_SUCCESS) { if (udid) { - printf("No device found with udid %s, is it plugged in?\n", udid); + printf("No device found with udid %s.\n", udid); } else { - printf("No device found, is it plugged in?\n"); + printf("No device found.\n"); } goto cleanup; } 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) printf("\n"); printf("OPTIONS:\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); + printf(" -n, --network\t\tconnect to network device\n"); printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -h, --help\t\tprints usage information\n"); printf(" -v, --version\t\tprints version information\n"); @@ -250,6 +251,7 @@ int main(int argc, char *argv[]) idevice_t device = NULL; thread_info_t *thread_list = NULL; const char* udid = NULL; + int use_network = 0; uint16_t local_port = 0; int server_fd; int result = EXIT_SUCCESS; @@ -294,6 +296,10 @@ int main(int argc, char *argv[]) udid = argv[i]; continue; } + else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { + use_network = 1; + continue; + } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { print_usage(argc, argv); return EXIT_SUCCESS; @@ -320,12 +326,12 @@ int main(int argc, char *argv[]) } /* start services and connect to device */ - ret = idevice_new(&device, udid); + ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); if (ret != IDEVICE_E_SUCCESS) { if (udid) { - fprintf(stderr, "No device found with udid %s, is it plugged in?\n", udid); + fprintf(stderr, "No device found with udid %s.\n", udid); } else { - fprintf(stderr, "No device found, is it plugged in?\n"); + fprintf(stderr, "No device found.\n"); } result = EXIT_FAILURE; 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) int result = EXIT_FAILURE; int i; const char *udid = NULL; + int use_network = 0; int cmd = CMD_NONE; char* cmd_arg = NULL; plist_t node = NULL; @@ -95,6 +96,10 @@ int main(int argc, char **argv) udid = argv[i]; continue; } + else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { + use_network = 1; + continue; + } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { print_usage(argc, argv); result = EXIT_SUCCESS; @@ -191,11 +196,11 @@ int main(int argc, char **argv) goto cleanup; } - if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { + if (IDEVICE_E_SUCCESS != idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX)) { if (udid) { - printf("No device found with udid %s, is it plugged in?\n", udid); + printf("No device found with udid %s.\n", udid); } else { - printf("No device found, is it plugged in?\n"); + printf("No device found.\n"); } goto cleanup; } @@ -335,6 +340,7 @@ void print_usage(int argc, char **argv) printf("\n"); printf("The following OPTIONS are accepted:\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); + printf(" -n, --network\t\tconnect to network device\n"); printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -h, --help\t\tprints usage information\n"); 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[]) ret = idevice_new(&device, udid); if (ret != IDEVICE_E_SUCCESS) { - printf("No device found with udid %s, is it plugged in?\n", udid); + printf("No device found with udid %s.\n", udid); return -1; } 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 @@ #include "common/utils.h" static int list_mode = 0; +static int use_network = 0; static int xml_mode = 0; static char *udid = NULL; static char *imagetype = NULL; @@ -72,6 +73,7 @@ static void print_usage(int argc, char **argv) printf("\n"); printf("OPTIONS:\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); + printf(" -n, --network\t\tconnect to network device\n"); printf(" -l, --list\t\tList mount information\n"); printf(" -t, --imagetype\tImage type to use, default is 'Developer'\n"); printf(" -x, --xml\t\tUse XML output\n"); @@ -86,19 +88,20 @@ static void print_usage(int argc, char **argv) static void parse_opts(int argc, char **argv) { static struct option longopts[] = { - { "help", no_argument, NULL, 'h'}, - { "udid", required_argument, NULL, 'u'}, - { "list", no_argument, NULL, 'l'}, - { "imagetype", required_argument, NULL, 't'}, - { "xml", no_argument, NULL, 'x'}, - { "debug", no_argument, NULL, 'd'}, + { "help", no_argument, NULL, 'h' }, + { "udid", required_argument, NULL, 'u' }, + { "network", no_argument, NULL, 'n' }, + { "list", no_argument, NULL, 'l' }, + { "imagetype", required_argument, NULL, 't' }, + { "xml", no_argument, NULL, 'x' }, + { "debug", no_argument, NULL, 'd' }, { "version", no_argument, NULL, 'v' }, { NULL, 0, NULL, 0 } }; int c; while (1) { - c = getopt_long(argc, argv, "hu:lt:xdv", longopts, NULL); + c = getopt_long(argc, argv, "hu:lt:xdnv", longopts, NULL); if (c == -1) { break; } @@ -116,6 +119,9 @@ static void parse_opts(int argc, char **argv) free(udid); udid = strdup(optarg); break; + case 'n': + use_network = 1; + break; case 'l': list_mode = 1; break; @@ -191,8 +197,12 @@ int main(int argc, char **argv) } } - if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { - printf("No device found, is it plugged in?\n"); + if (IDEVICE_E_SUCCESS != idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX)) { + if (udid) { + printf("No device found with udid %s.\n", udid); + } else { + printf("No device found.\n"); + } return -1; } 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) "\n" \ "OPTIONS:\n" \ " -u, --udid UDID target specific device by UDID\n" \ - " -n, --network connect to network device even if available via USB\n" \ + " -n, --network connect to network device\n" \ " -s, --simple use a simple connection to avoid auto-pairing with the device\n" \ " -q, --domain NAME set domain of query to NAME. Default: None\n" \ " -k, --key NAME only query key specified by NAME. Default: All keys.\n" \ @@ -130,12 +130,12 @@ int main(int argc, char *argv[]) int simple = 0; int format = FORMAT_KEY_VALUE; char* udid = NULL; + int use_network = 0; char *domain = NULL; char *key = NULL; char *xml_doc = NULL; uint32_t xml_length; plist_t node = NULL; - enum idevice_options lookup_opts = IDEVICE_LOOKUP_USBMUX | IDEVICE_LOOKUP_NETWORK; int c = 0; const struct option longopts[] = { @@ -170,7 +170,7 @@ int main(int argc, char *argv[]) udid = strdup(optarg); break; case 'n': - lookup_opts |= IDEVICE_LOOKUP_PREFER_NETWORK; + use_network = 1; break; case 'q': if (!*optarg) { @@ -211,7 +211,7 @@ int main(int argc, char *argv[]) argc -= optind; argv += optind; - ret = idevice_new_with_options(&device, udid, lookup_opts); + ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); if (ret != IDEVICE_E_SUCCESS) { if (udid) { 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) printf("Display the device name or set it to NAME if specified.\n"); printf("\n"); printf("OPTIONS:\n"); - printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); + printf(" -n, --network\t\tconnect to network device\n"); + printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -h, --help\t\tprint usage information\n"); printf(" -v, --version\t\tprint version information\n"); printf("\n"); @@ -58,6 +59,7 @@ int main(int argc, char** argv) int c = 0; const struct option longopts[] = { { "udid", required_argument, NULL, 'u' }, + { "network", no_argument, NULL, 'n' }, { "debug", no_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'v' }, @@ -65,12 +67,13 @@ int main(int argc, char** argv) }; int res = -1; char* udid = NULL; + int use_network = 0; #ifndef WIN32 signal(SIGPIPE, SIG_IGN); #endif - while ((c = getopt_long(argc, argv, "du:hv", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "du:hnv", longopts, NULL)) != -1) { switch (c) { case 'u': if (!*optarg) { @@ -81,6 +84,9 @@ int main(int argc, char** argv) free(udid); udid = strdup(optarg); break; + case 'n': + use_network = 1; + break; case 'h': print_usage(); return 0; @@ -105,8 +111,12 @@ int main(int argc, char** argv) } idevice_t device = NULL; - if (idevice_new(&device, udid) != IDEVICE_E_SUCCESS) { - fprintf(stderr, "ERROR: Could not connect to device\n"); + if (idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX) != IDEVICE_E_SUCCESS) { + if (udid) { + fprintf(stderr, "ERROR: No device found with udid %s.\n", udid); + } else { + fprintf(stderr, "ERROR: No device found.\n"); + } return -1; } 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) printf("\n"); printf("The following OPTIONS are accepted:\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); + printf(" -n, --network\t\tconnect to network device\n"); printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -h, --help\t\tprints usage information\n"); printf(" -v, --version\t\tprints version information\n"); @@ -98,6 +99,7 @@ int main(int argc, char *argv[]) int result = -1; int i; const char* udid = NULL; + int use_network = 0; int cmd = CMD_NONE; char* cmd_arg = NULL; @@ -133,6 +135,10 @@ int main(int argc, char *argv[]) result = 0; goto cleanup; } + else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { + use_network = 1; + continue; + } else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) { printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION); result = 0; @@ -185,11 +191,11 @@ int main(int argc, char *argv[]) goto cleanup; } - if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { + if (IDEVICE_E_SUCCESS != idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX)) { if (udid) { - printf("No device found with udid %s, is it plugged in?\n", udid); + printf("No device found with udid %s.\n", udid); } else { - printf("No device found, is it plugged in?\n"); + printf("No device found.\n"); } goto cleanup; } 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) return EXIT_SUCCESS; } - if (udid) { - ret = idevice_new(&device, udid); - if (ret != IDEVICE_E_SUCCESS) { - printf("No device found with udid %s, is it plugged in?\n", udid); - free(udid); - return EXIT_FAILURE; + ret = idevice_new(&device, udid); + if (ret != IDEVICE_E_SUCCESS) { + if (udid) { + printf("No device found with udid %s.\n", udid); + } else { + printf("No device found.\n"); } free(udid); - udid = NULL; - } else { - ret = idevice_new(&device, NULL); + return EXIT_FAILURE; + } + if (!udid) { + ret = idevice_get_udid(device, &udid); if (ret != IDEVICE_E_SUCCESS) { - printf("No device found, is it plugged in?\n"); - return EXIT_FAILURE; + printf("ERROR: Could not get device udid, error code %d\n", ret); + result = EXIT_FAILURE; + goto leave; } } - ret = idevice_get_udid(device, &udid); - if (ret != IDEVICE_E_SUCCESS) { - printf("ERROR: Could not get device udid, error code %d\n", ret); - result = EXIT_FAILURE; - goto leave; - } - if (op == OP_HOSTID) { plist_t pair_record = NULL; char *hostid = NULL; @@ -244,7 +239,7 @@ int main(int argc, char **argv) return EXIT_SUCCESS; } - lerr = lockdownd_client_new(device, &client, "idevicepair"); + lerr = lockdownd_client_new(device, &client, TOOL_NAME); if (lerr != LOCKDOWN_E_SUCCESS) { idevice_free(device); 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) printf("\n"); printf("The following OPTIONS are accepted:\n"); printf(" -u, --udid UDID target specific device by UDID\n"); + printf(" -n, --network connect to network device\n"); printf(" -x, --xml print XML output when using the 'dump' command\n"); printf(" -d, --debug enable communication debugging\n"); printf(" -h, --help prints usage information\n"); @@ -300,6 +301,7 @@ int main(int argc, char *argv[]) const char* udid = NULL; const char* param = NULL; const char* param2 = NULL; + int use_network = 0; #ifndef WIN32 signal(SIGPIPE, SIG_IGN); @@ -319,6 +321,10 @@ int main(int argc, char *argv[]) udid = argv[i]; continue; } + else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { + use_network = 1; + continue; + } else if (!strcmp(argv[i], "install")) { i++; if (!argv[i] || (strlen(argv[i]) < 1)) { @@ -437,12 +443,12 @@ int main(int argc, char *argv[]) } } - ret = idevice_new(&device, udid); + ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); if (ret != IDEVICE_E_SUCCESS) { if (udid) { - printf("No device found with udid %s, is it plugged in?\n", udid); + printf("No device found with udid %s.\n", udid); } else { - printf("No device found, is it plugged in?\n"); + printf("No device found.\n"); } return -1; } 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) int result = -1; int i; const char *udid = NULL; + int use_network = 0; char *filename = NULL; #ifndef WIN32 @@ -70,6 +71,10 @@ int main(int argc, char **argv) udid = argv[i]; continue; } + else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { + use_network = 1; + continue; + } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { print_usage(argc, argv); return 0; @@ -88,11 +93,11 @@ int main(int argc, char **argv) } } - if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { + if (IDEVICE_E_SUCCESS != idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX)) { if (udid) { - printf("No device found with udid %s, is it plugged in?\n", udid); + printf("No device found with udid %s.\n", udid); } else { - printf("No device found, is it plugged in?\n"); + printf("No device found.\n"); } return -1; } @@ -174,6 +179,7 @@ void print_usage(int argc, char **argv) printf("the screenshotr service is not available.\n"); printf("\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); + printf(" -n, --network\t\tconnect to network device\n"); printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -h, --help\t\tprints usage information\n"); 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) fprintf(is_error ? stderr : stdout, "\n" \ "OPTIONS:\n" \ " -u, --udid UDID target specific device by UDID\n" \ - " -n, --network connect to network device even if available via USB\n" \ + " -n, --network connect to network device\n" \ " -d, --debug enable communication debugging\n" \ " -h, --help prints usage information\n" \ " -v, --version prints version information\n" \ @@ -77,7 +77,7 @@ int main(int argc, char **argv) }; uint32_t mode = 0; char *udid = NULL; - enum idevice_options lookup_opts = IDEVICE_LOOKUP_USBMUX | IDEVICE_LOOKUP_NETWORK; + int use_network = 0; while ((c = getopt_long(argc, argv, "dhu:nv", longopts, NULL)) != -1) { switch (c) { @@ -94,7 +94,7 @@ int main(int argc, char **argv) udid = strdup(optarg); break; case 'n': - lookup_opts |= IDEVICE_LOOKUP_PREFER_NETWORK; + use_network = 1; break; case 'h': print_usage(argc, argv, 0); @@ -129,7 +129,7 @@ int main(int argc, char **argv) idevice_t device = NULL; - if (idevice_new_with_options(&device, udid, lookup_opts) != IDEVICE_E_SUCCESS) { + if (idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX) != IDEVICE_E_SUCCESS) { if (udid) { printf("ERROR: Device %s not found!\n", udid); } 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; static 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"; -enum idevice_options lookup_opts = IDEVICE_LOOKUP_USBMUX | IDEVICE_LOOKUP_NETWORK; +static int use_network = 0; static char *line = NULL; static int line_buffer_size = 0; @@ -403,7 +403,7 @@ static void syslog_callback(char c, void *user_data) static int start_logging(void) { - idevice_error_t ret = idevice_new_with_options(&device, udid, lookup_opts); + idevice_error_t ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); if (ret != IDEVICE_E_SUCCESS) { fprintf(stderr, "Device with udid %s not found!?\n", udid); return -1; @@ -526,7 +526,7 @@ static void print_usage(int argc, char **argv, int is_error) "\n" \ "OPTIONS:\n" \ " -u, --udid UDID target specific device by UDID\n" \ - " -n, --network connect to network device even if available via USB\n" \ + " -n, --network connect to network device\n" \ " -x, --exit exit when device disconnects\n" \ " -h, --help prints usage information\n" \ " -d, --debug enable communication debugging\n" \ @@ -610,7 +610,7 @@ int main(int argc, char *argv[]) udid = strdup(optarg); break; case 'n': - lookup_opts |= IDEVICE_LOOKUP_PREFER_NETWORK; + use_network = 1; break; case 'q': exclude_filter++; |