Analysis steps for usb adb offline

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

you should check adb server side firstly while adb offline reproduct.

1.1 restart adb server

>adb kill-server

>adb devices
if device online after adb server restart, it should be adb server issue, you could test with different adb version.

check adb version/help:

>adb version

>adb help
1.2 test with different adb version

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:

>set ADB_TRACE=1
ubuntu:
$export ADB_TRACE=1
2. adbd

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.

 Stability - Coredump - enable

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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值