Adb is google tool, most of the issues you should report to google side. We met adb offline problem sometimes, it's different root cause.
Here's checklists for such issue:
1. adb server side
2. adbdyou should check adb server side firstly while adb offline reproduct.
1.1 restart adb server
if device online after adb server restart, it should be adb server issue, you could test with different adb version.>adb kill-server >adb devices
check adb version/help:
1.2 test with different adb version>adb version >adb help
1.3 test on different PC
if device online , you should check adb driver(PC side/device side) or usb transfer.
1.4 Check PC adb server logs:
open debug log:
windows:
ubuntu:>set ADB_TRACE=1
$export ADB_TRACE=1
2.1 restart adbd
2.1.1 disable usb debugging and enable back
2.1.2 swith to different usb function, charging only -> mtp, mtp -> midi, ......
if device online, it should be adbd issue.
2.2 debug adbd on android O
you can just check adbd log with logcat:
#logcat -v threadtime -s adbd
or just pull adbd log :
>adb pull /data/adb/... ./
or :
#ls -l /data/adb/
#cat /data/adb/...
2.2.1 open adbd debug trace by shell
>adb root
>adb shell setprop persist.adb.trace_mask all
Plz refer this code to setprop the property value:
91std::string get_trace_setting() {
92#if ADB_HOST
93 return get_trace_setting_from_env();
94#else
95 return android::base::GetProperty("persist.adb.trace_mask", "");
96#endif
97}
112 std::unordered_map<std::string, int> trace_flags = {
113 {"1", -1},
114 {"all", -1},
115 {"adb", ADB},
116 {"sockets", SOCKETS},
117 {"packets", PACKETS},
118 {"rwx", RWX},
119 {"usb", USB},
120 {"sync", SYNC},
121 {"sysdeps", SYSDEPS},
122 {"transport", TRANSPORT},
123 {"jdwp", JDWP},
124 {"services", SERVICES},
125 {"auth", AUTH},
126 {"fdevent", FDEVENT},
127 {"shell", SHELL}};
2.2.2 open adbd debug in source code
diff --git a/adb/adb_trace.cpp b/adb/adb_trace.cpp
index eac923d..3dc2687 100644
--- a/adb/adb_trace.cpp
+++ b/adb/adb_trace.cpp
@@ -92,7 +92,8 @@ std::string get_trace_setting() {
#if ADB_HOST
return get_trace_setting_from_env();
#else
- return android::base::GetProperty("persist.adb.trace_mask", "");
+ //return android::base::GetProperty("persist.adb.trace_mask", "");
+ return "all";
#endif
}
or:
diff --git a/adb/adb_trace.h b/adb/adb_trace.h
index fc6560c..eb5a922 100644
--- a/adb/adb_trace.h
+++ b/adb/adb_trace.h
@@ -44,9 +44,6 @@ enum AdbTrace {
((adb_trace_mask & (1 << (TAG))) != 0)
#define VLOG(TAG) \
- if (LIKELY(!VLOG_IS_ON(TAG))) \
- ; \
- else \
LOG(INFO)
// You must define TRACE_TAG before using this macro.
2.2.3 Catch core dump for adbd
if adbd killed abnormal or you want to trace adbd backtrace, enable core dump feature.
3. adb gadget driver - f_fs.c
3.1 check kernel log and adb ipc log:
#dmesg -c
#cat /d/ipc_logging/f_fs/log
3.2 check usb protocol analyzer log
3.2.1 It's better catch usb protocol log with LeCroy usb protocol analyzer
3.2.2 Bus hound log