Merge "Show "(reverse)" in "adb reverse --list"."
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index 4e0db2b..7d6de98 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -1200,10 +1200,12 @@
return 0;
}
}
+ else if (!strcmp(argv[0], "tcpip") && argc > 1) {
+ return adb_connect_command(android::base::StringPrintf("tcpip:%s", argv[1]));
+ }
else if (!strcmp(argv[0], "remount") ||
!strcmp(argv[0], "reboot") ||
!strcmp(argv[0], "reboot-bootloader") ||
- !strcmp(argv[0], "tcpip") ||
!strcmp(argv[0], "usb") ||
!strcmp(argv[0], "root") ||
!strcmp(argv[0], "unroot") ||
diff --git a/adb/services.cpp b/adb/services.cpp
index b9c532a..2e3ad98 100644
--- a/adb/services.cpp
+++ b/adb/services.cpp
@@ -486,7 +486,7 @@
} else if(!strncmp(name, "tcpip:", 6)) {
int port;
if (sscanf(name + 6, "%d", &port) != 1) {
- port = 0;
+ return -1;
}
ret = create_service_thread(restart_tcp_service, (void *) (uintptr_t) port);
} else if(!strncmp(name, "usb:", 4)) {
diff --git a/adb/tests/test_adb.py b/adb/tests/test_adb.py
index 730f668..3099554 100755
--- a/adb/tests/test_adb.py
+++ b/adb/tests/test_adb.py
@@ -186,7 +186,7 @@
remote))
def tcpip(self, port):
- return call_checked(self.adb_cmd + "tcpip {}".format(port))
+ return call_combined(self.adb_cmd + "tcpip {}".format(port))
def usb(self):
return call_checked(self.adb_cmd + "usb")
@@ -326,6 +326,16 @@
else:
self.assertEqual(output, "Linux\n")
+ def test_tcpip(self):
+ """adb tcpip requires a port. http://b/22636927"""
+ output, status_code = AdbWrapper().tcpip("")
+ self.assertEqual(1, status_code)
+ self.assertIn("help message", output)
+
+ output, status_code = AdbWrapper().tcpip("blah")
+ self.assertEqual(1, status_code)
+ self.assertIn("error", output)
+
class AdbFile(unittest.TestCase):
SCRATCH_DIR = "/data/local/tmp"
diff --git a/init/log.h b/init/log.h
index b804d1f..c5c30af 100644
--- a/init/log.h
+++ b/init/log.h
@@ -20,8 +20,11 @@
#include <cutils/klog.h>
#define ERROR(x...) init_klog_write(KLOG_ERROR_LEVEL, x)
+#define WARNING(x...) init_klog_write(KLOG_WARNING_LEVEL, x)
#define NOTICE(x...) init_klog_write(KLOG_NOTICE_LEVEL, x)
#define INFO(x...) init_klog_write(KLOG_INFO_LEVEL, x)
+#define DEBUG(x...) init_klog_write(KLOG_DEBUG_LEVEL, x)
+#define VERBOSE(x...) init_klog_write(KLOG_DEBUG_LEVEL, x)
void init_klog_write(int level, const char* fmt, ...) __printflike(2, 3);
int selinux_klog_callback(int level, const char* fmt, ...) __printflike(2, 3);
diff --git a/init/watchdogd.cpp b/init/watchdogd.cpp
index 881a4df..0d16db9 100644
--- a/init/watchdogd.cpp
+++ b/init/watchdogd.cpp
@@ -38,29 +38,30 @@
int margin = 10;
if (argc >= 3) margin = atoi(argv[2]);
- NOTICE("watchdogd started (interval %d, margin %d)!\n", interval, margin);
+ NOTICE("started (interval %d, margin %d)!\n", interval, margin);
int fd = open(DEV_NAME, O_RDWR|O_CLOEXEC);
if (fd == -1) {
- ERROR("watchdogd: Failed to open %s: %s\n", DEV_NAME, strerror(errno));
+ ERROR("Failed to open %s: %s\n", DEV_NAME, strerror(errno));
return 1;
}
int timeout = interval + margin;
int ret = ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
if (ret) {
- ERROR("watchdogd: Failed to set timeout to %d: %s\n", timeout, strerror(errno));
+ ERROR("Failed to set timeout to %d: %s\n", timeout, strerror(errno));
ret = ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
if (ret) {
- ERROR("watchdogd: Failed to get timeout: %s\n", strerror(errno));
+ ERROR("Failed to get timeout: %s\n", strerror(errno));
} else {
if (timeout > margin) {
interval = timeout - margin;
} else {
interval = 1;
}
- ERROR("watchdogd: Adjusted interval to timeout returned by driver: timeout %d, interval %d, margin %d\n",
- timeout, interval, margin);
+ WARNING("Adjusted interval to timeout returned by driver:"
+ " timeout %d, interval %d, margin %d\n",
+ timeout, interval, margin);
}
}