* Илья Мыльница: Hi Ilya,
>> How this relevant for the host-only, Debian-specifc build? > I'm afraid, google may remove dependancy on their libcutils in the > future. Perhaps, it's better to provide own implementation of a local > transport rather than use google code intended for an android daemon. > It's up to you, though. Since the code is there to use, I'm not going to change anything fow now. As long as upstream does not change anything, we're good. > Considering the last patch, it's almost OK. Could you look at > local_connect_arbitrary_ports in transport_local.c? Seems another > place where adb requires a network server. Thanks for pointing this out. Since there already was a separate code path for the "local" socket, I have changed that, too. Here's the updated patch. Cheers, -Hilko
Index: android-tools-4.2.2+git20130529/core/adb/adb.c =================================================================== --- android-tools-4.2.2+git20130529.orig/core/adb/adb.c 2013-07-10 00:22:47.063103997 +0200 +++ android-tools-4.2.2+git20130529/core/adb/adb.c 2013-07-10 00:22:47.051104285 +0200 @@ -1154,7 +1154,11 @@ */ void build_local_name(char* target_str, size_t target_size, int server_port) { - snprintf(target_str, target_size, "tcp:%d", server_port); + if (gListenAll > 0) { + snprintf(target_str, target_size, "tcp:%d", server_port); + } else { + snprintf(target_str, target_size, "local:%d", server_port); + } } #if !ADB_HOST Index: android-tools-4.2.2+git20130529/core/adb/adb_client.c =================================================================== --- android-tools-4.2.2+git20130529.orig/core/adb/adb_client.c 2013-07-10 00:22:47.063103997 +0200 +++ android-tools-4.2.2+git20130529/core/adb/adb_client.c 2013-07-10 00:22:47.051104285 +0200 @@ -185,12 +185,12 @@ strcpy(__adb_error, "service name too long"); return -1; } - snprintf(tmp, sizeof tmp, "%04x", len); + snprintf(tmp, sizeof tmp, "%d", __adb_server_port); if (__adb_server_name) fd = socket_network_client(__adb_server_name, __adb_server_port, SOCK_STREAM); else - fd = socket_loopback_client(__adb_server_port, SOCK_STREAM); + fd = socket_local_client(tmp, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM); if(fd < 0) { strcpy(__adb_error, "cannot connect to daemon"); @@ -201,6 +201,7 @@ return -1; } + snprintf(tmp, sizeof tmp, "%04x", len); if(writex(fd, tmp, 4) || writex(fd, service, len)) { strcpy(__adb_error, "write failure during connection"); adb_close(fd); Index: android-tools-4.2.2+git20130529/core/adb/transport_local.c =================================================================== --- android-tools-4.2.2+git20130529.orig/core/adb/transport_local.c 2013-05-29 22:16:54.000000000 +0200 +++ android-tools-4.2.2+git20130529/core/adb/transport_local.c 2013-07-13 16:56:58.729645369 +0200 @@ -118,7 +118,8 @@ } #endif if (fd < 0) { - fd = socket_loopback_client(adb_port, SOCK_STREAM); + snprintf(buf, sizeof buf, "%d", adb_port); + fd = socket_local_client(buf, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM); } if (fd >= 0) {