From 489a673aeeef4706af3986d41c24ab434e77d7d5 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Fri, 5 Jun 2020 20:50:34 +0200 Subject: tools: Unify --network command line switch and add it where missing --- tools/idevicedebug.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tools/idevicedebug.c') 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; } -- cgit v1.1-32-gdbae