先贴出来成功的脚本吧
for i in `cat ip.txt`
do
adb disconnect
adb connect ${i}
sleep 2
adb root
sleep 2
adb connect ${i}
sleep 2
adb remount
sleep 2
adb push librk_vpuapi.so /system/lib/
sleep 2
adb push libvpu.so /system/lib/
sleep 2
echo "start reboot ${i}"
curl -X POST "http://${i}:9001/v1/system/reboot"
done
如果我把脚本中的sleep 2
去掉的话,运行就会是这样的
connected to 10.20.18.148:5555
error: device offline
10.20.18.30
>connected to 10.20.18.30:5555
error: device offline
10.20.18.144
>connected to 10.20.18.144:5555
error: device offline
10.20.18.40
1
crayygy 2017-07-14 15:25:31 +08:00 via iPhone
给一点反应时间嘛
|
2
ReVanTis 2017-07-14 16:15:52 +08:00
试试 adb -s SERIAL wait-for-device
|
3
21grams 2017-07-14 16:26:44 +08:00 via Android
adb 什么版本的
|
4
zealot0630 2017-07-14 16:37:54 +08:00
adb root 会重起手机的 adb 进程,会导致 adb offline,再 adb 后面加一句 adb wait-xxx 可破
|
5
warcraft1236 OP @zealot0630 我是网络连接 adb 的,adb root 之后,就断开了,并不是 offline 啊,需要重新 adb connect,不重新 connect,直接 adb wait-device 没效果啊
|
6
kmahyyg 2017-07-14 17:28:43 +08:00 via Android
需要一个反应和认证时间,你自己先执行下 adb kill-server && adb start-server 看看这玩意启动要耗多长时间,尤其是版本不够高的情况耗时更长
|
7
264768502 2017-07-15 10:42:20 +08:00 via Android
root 后先 disconnect
|