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/idevicenotificationproxy.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'tools/idevicenotificationproxy.c') 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; } -- cgit v1.1-32-gdbae