diff options
author | Stefan Hilzinger <hilzinger@google.com> | 2010-04-19 12:21:12 +0100 |
---|---|---|
committer | Stefan Hilzinger <hilzinger@google.com> | 2010-04-22 20:39:32 +0100 |
commit | d0eacb8aee77f01edadf525019f8dd1e43671ce7 (patch) | |
tree | 780bd5f626d73d4befff2194fe7e6f2a6412c75a /adb/adb_client.c | |
parent | 3532722be02d6c88b172af10f80149eac36da0e8 (diff) | |
download | system_core-d0eacb8aee77f01edadf525019f8dd1e43671ce7.zip system_core-d0eacb8aee77f01edadf525019f8dd1e43671ce7.tar.gz system_core-d0eacb8aee77f01edadf525019f8dd1e43671ce7.tar.bz2 |
Make adb's daemon-port on the host machine configurable.
This is the first CL of a somewhat larger effort which, among other things,
will involve changing the emulator and ddms to talk to adb running on a
configurable port.
The port can be configured using environment variable ANDROID_ADB_SERVER_PORT.
Further CLs will also address the set of ports used for the local transport.
Change-Id: Ib2f431801f0adcd9f2dd290a28005644a36a780a
Diffstat (limited to 'adb/adb_client.c')
-rw-r--r-- | adb/adb_client.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/adb/adb_client.c b/adb/adb_client.c index 243f0fa..882810a 100644 --- a/adb/adb_client.c +++ b/adb/adb_client.c @@ -16,12 +16,19 @@ static transport_type __adb_transport = kTransportAny; static const char* __adb_serial = NULL; +static int __adb_server_port = DEFAULT_ADB_PORT; + void adb_set_transport(transport_type type, const char* serial) { __adb_transport = type; __adb_serial = serial; } +void adb_set_tcp_specifics(int server_port) +{ + __adb_server_port = server_port; +} + int adb_get_emulator_console_port(void) { const char* serial = __adb_serial; @@ -174,7 +181,7 @@ int _adb_connect(const char *service) } snprintf(tmp, sizeof tmp, "%04x", len); - fd = socket_loopback_client(ADB_PORT, SOCK_STREAM); + fd = socket_loopback_client(__adb_server_port, SOCK_STREAM); if(fd < 0) { strcpy(__adb_error, "cannot connect to daemon"); return -2; @@ -204,9 +211,10 @@ int adb_connect(const char *service) int fd = _adb_connect("host:version"); if(fd == -2) { - fprintf(stdout,"* daemon not running. starting it now *\n"); + fprintf(stdout,"* daemon not running. starting it now on port %d *\n", + __adb_server_port); start_server: - if(launch_server(0)) { + if(launch_server(__adb_server_port)) { fprintf(stderr,"* failed to start daemon *\n"); return -1; } else { @@ -314,5 +322,3 @@ oops: adb_close(fd); return 0; } - - |