From 1eb641ac33c7a113a340c33b4fa063608c4e54c2 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Mon, 6 Nov 2017 12:44:25 +0100 Subject: [PATCH] Support connecting to usbmuxd on a remote host. --- tools/iproxy.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tools/iproxy.c b/tools/iproxy.c index 87bfd49..d7b38d2 100644 --- a/tools/iproxy.c +++ b/tools/iproxy.c @@ -63,6 +63,8 @@ struct client_data { volatile int stop_stoc; }; +#define USBMUXD_SOCKET_PORT 27015 + static void *run_stoc_loop(void *arg) { struct client_data *cdata = (struct client_data*)arg; @@ -260,12 +262,12 @@ int main(int argc, char **argv) int mysock = -1; if (argc < 3) { - printf("usage: %s LOCAL_TCP_PORT DEVICE_TCP_PORT [UDID] [TCP|UNIX]\n", argv[0]); + printf("usage: %s LOCAL_TCP_PORT DEVICE_TCP_PORT [UDID] [USBMUXD_HOST]\n", argv[0]); printf("\n"); printf("LOCAL_TCP_PORT:\t\tThe TCP port to open on the host machine\n"); printf("DEVICE_TCP_PORT:\tThe TCP port to which to connect on the device\n"); printf("UDID:\t\t\tThe UDID of the device to which to connect\n"); - printf("[TCP|UNIX]:\t\tThe socket protocol to use to connect to usbmuxd. Can only be specified in combination with UDID.\n"); + printf("USBMUXD_HOST:\t\tThe The host on which usbmuxd is running. Can only be specified in combination with UDID. Forces TCP communication with usbmuxd.\n"); return 0; } @@ -277,14 +279,8 @@ int main(int argc, char **argv) } if (argc > 4) { - if (strcasecmp(argv[4], "TCP") == 0) { - usbmuxd_set_socket_type(SOCKET_TYPE_TCP); - } else if (strcasecmp(argv[4], "UNIX") == 0) { - usbmuxd_set_socket_type(SOCKET_TYPE_UNIX); - } else { - fprintf(stderr, "Invalid socket protocol specified!\n"); - return -EINVAL; - } + usbmuxd_set_socket_type(SOCKET_TYPE_TCP); + usbmuxd_set_tcp_endpoint(argv[4], USBMUXD_SOCKET_PORT); } if (!listen_port) {