file: system/core/adb/adb.c line: 921 /* for the device, start the usb transport if the ** android usb device exists and "service.adb.tcp" ** is not set, otherwise start the network transport. */ property_get("service.adb.tcp.port", value, "0"); if (sscanf(value, "%d", &port) == 1 && port > 0) { // listen on TCP port specified by service.adb.tcp.port property local_init(port); } else if (access("/dev/android_adb", F_OK) == 0) { // listen on USB usb_init(); } else { // listen on default port local_init(ADB_LOCAL_TRANSPORT_PORT); }
根據上面的代碼, 執行以下命令
stop adbd
setprop service.adb.tcp.port 5555
start adbd
便能開啟網絡調試的端口,PC端執行
adb connect <host>[:<prot>]
即可使用tcp協議連接Andorid設備。
putty連接Android設備
Android設備需要安裝一個SSH Server軟件,建議SSHDroid,https://apkpure.com/cn/sshdroid/berserker.android.apps.sshdroid
然后就可以通過putty連接了。