Comments (4)
Sure it is possible to do it
from adbutils.
The adbutils need make some update to support asyncio
from adbutils.
i am also waiting for this feature. and i also like the adbkit provide by you.
from adbutils.
a simple way that using the exist installed adbkit and can be only used one device connected.
from adbutils import adb
import os
import subprocess
global connected_device
connected_device =[]
# 监控设备连接 track-devices
os.system("adb start-server")
while True:
try:
for event in adb.track_devices():
if "emulator" in event.serial or "0123456789ABCDEF" in event.serial:
continue
print(event.present, event.serial, event.status)
if event.status == 'device':
connected_device.append(event.serial)
cmd = 'adbkit usb-device-to-tcp -p 5555 {}'.format(event.serial)
p = subprocess.Popen(cmd, shell=True)
print(f"set the device {event.serial} to tcp port 5555")
if event.serial in connected_device and event.status !="device":
connected_device.remove(event.serial)
if p is not None:
p.terminate()
p = None
print(f"set the device {event.serial} is offline")
except InterruptedError:
break
except Exception as e:
print(f'adb killed server:{e}')
if connected_device !=[]:
connected_device=[]
if p is not None:
p.terminate()
p = None
os.system("adb start-server")
finally:
if p is not None:
p.terminate()
p = None
os.system("adb start-server")
from adbutils.
Related Issues (20)
- MultiScreen Support HOT 2
- Issue with `device.sync.push` Resulting in `AdbError: FAIL` HOT 3
- Feature Request: Add `restart_adb_server()` Function to Simplify ADB Server Restart HOT 10
- ADB 录制屏幕失败 HOT 3
- 可以在_proto.py里面增加AppInfo类型的返回码?
- "invalid decoded string length" when parsing manifest HOT 2
- mdns support?(auto connect wireless devices) HOT 3
- AdbConnection创建连接超时 HOT 2
- 脚本退出后还残留一个后台adb.exe HOT 2
- 停止录屏windows系统报错 HOT 1
- Package is missing py.typed HOT 4
- internal exception occurred when using device.install() for some apks
- windows平台adb服务未启动时会报错,不能自动启动 HOT 1
- Since 2.6.0, shell command with serial on ubuntu system will raise adbutils.errors.AdbError: unknown host service
- ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
- Merge `adbutils_async` as an Asynchronous Version of `adbutils`? HOT 2
- Screenshots not working with Android 23 HOT 2
- 是否有支持文件pull/push文件的传输进度的功能
- ValueError when using the .battery() method
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adbutils.