操作步骤
本地电脑 Local-A. 远程电脑 Remote-B 和 跟 Remote-B 通过 USB 连接的手机 C
1. 手机 C 连接到 Remote-B
2. Remote-B
通adb tcpip <port> 将台架的adb设置为以太网模式,从而使台架的adb服务可以被端口绑定。
# enable adb ethernet connection
adb tcpip 5555
配置 nginx
5. 修改跳板机nginx配置,将端口绑定到对应的跳板机端口,从而转发adb服务。
# /etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid
/run/nginx
.pid;
include
/etc/nginx/modules-enabled/
*.conf;
events {
worker_connections 768;
# multi_accept on;
}
stream {
server {
listen 5555;
# Same thing here to bind 169.254.212.220:5555 (the adb) will be bound to <your jumper ip>:5555. The 5555 port is for adb ethernet connection.
proxy_pass 手机ip地址:5555;
}
}
检查nginx配置并重启跳板机nginx服务,重新加载配置
# check nginx configuration
product
sudo
nginx -t
# reload nginx config
sudo
systemctl restart nginx.service
客户端
db connect <跳板机ip>。之后就可以正常的使用adb或者scrcpy了。