From 06e7cb5af010ba489aa09bf69a4491f6bf59a7dc Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Tue, 17 Sep 2019 17:34:41 +0800 Subject: [PATCH] adbd: allow port configuration on host. Test: manual Change-Id: I68cbd9bdb253a68463cc65e63a764ad4fa410c1c --- adb/daemon/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp index e5a49171b..9ebab740e 100644 --- a/adb/daemon/main.cpp +++ b/adb/daemon/main.cpp @@ -248,6 +248,12 @@ int adbd_main(int server_port) { prop_port = android::base::GetProperty("persist.adb.tcp.port", ""); } +#if !defined(__ANDROID__) + if (prop_port.empty() && getenv("ADBD_PORT")) { + prop_port = getenv("ADBD_PORT"); + } +#endif + int port; if (sscanf(prop_port.c_str(), "%d", &port) == 1 && port > 0) { D("using port=%d", port);