-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathstart.py
More file actions
36 lines (26 loc) · 987 Bytes
/
start.py
File metadata and controls
36 lines (26 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
import logging
from adb.adb import ADB
if __name__ == "__main__":
# Logging configuration.
logger = logging.getLogger(__name__)
logging.basicConfig(
format="%(asctime)s> [%(levelname)s][%(name)s][%(funcName)s()] %(message)s",
datefmt="%d/%m/%Y %H:%M:%S",
level=logging.INFO,
)
# This is an example file showing how the adb wrapper can be used.
adb = ADB()
# Start with a clean adb server.
adb.kill_server()
adb.connect()
adb_version = adb.get_version()
logger.info("ADB version: {0}".format(adb_version))
connected_devices = adb.get_available_devices()
logger.info("Connected devices: {0}".format(connected_devices))
# Set the first device in the list as the target of the subsequent commands.
adb.target_device = connected_devices[0]
adb.wait_for_device()
logger.info(
"Message from Android device: {0}".format(adb.shell(['echo "Hello World!"']))
)