Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Support connecting to usbmuxd on a remote host.
Browse files Browse the repository at this point in the history
  • Loading branch information
qmfrederik committed Oct 3, 2019
1 parent 7e107f7 commit 1eb641a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions tools/iproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -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) {
Expand Down

0 comments on commit 1eb641a

Please sign in to comment.