taotoolkit 2.0.3__tar.gz → 2.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/PKG-INFO +2 -2
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/pyproject.toml +2 -2
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit/__init__.py +1 -1
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit/tao_device.py +30 -3
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit/tao_tuning.py +1 -1
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit.egg-info/PKG-INFO +2 -2
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit.egg-info/requires.txt +1 -1
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/README.md +0 -0
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/setup.cfg +0 -0
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit/asrVrf.py +0 -0
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit/tao_camDvt.py +0 -0
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit/tao_cmdTool.py +0 -0
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit/tao_common.py +0 -0
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit/tao_flash.py +0 -0
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit/tao_vrfTool.py +0 -0
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit.egg-info/SOURCES.txt +0 -0
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit.egg-info/dependency_links.txt +0 -0
- {taotoolkit-2.0.3 → taotoolkit-2.0.4}/taotoolkit.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: taotoolkit
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.4
|
|
4
4
|
Summary: Tao ToolKit
|
|
5
5
|
Author-email: taotaoli <taotaoli@asrmicro.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -19,7 +19,7 @@ Requires-Dist: beautifulsoup4>=4.10.0
|
|
|
19
19
|
Requires-Dist: pyyaml>=6.0.3
|
|
20
20
|
Requires-Dist: pywinpty>=3.0.5; platform_system == "Windows"
|
|
21
21
|
Provides-Extra: uiautomator
|
|
22
|
-
Requires-Dist: uiautomator2>=2.0.
|
|
22
|
+
Requires-Dist: uiautomator2>=2.0.4; extra == "uiautomator"
|
|
23
23
|
|
|
24
24
|
# TAO - Toolkit
|
|
25
25
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "taotoolkit"
|
|
7
|
-
version = "2.0.
|
|
7
|
+
version = "2.0.4"
|
|
8
8
|
description = "Tao ToolKit"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -29,5 +29,5 @@ dependencies = [
|
|
|
29
29
|
|
|
30
30
|
[project.optional-dependencies]
|
|
31
31
|
uiautomator = [
|
|
32
|
-
"uiautomator2>=2.0.
|
|
32
|
+
"uiautomator2>=2.0.4",
|
|
33
33
|
]
|
|
@@ -47,6 +47,8 @@ from .tao_common import (
|
|
|
47
47
|
|
|
48
48
|
CACHE_FILE = os.path.join(os.path.dirname(__file__), ".dev_cache.json")
|
|
49
49
|
CACHE_TTL = 3600
|
|
50
|
+
# 匹配 "SERIAL\tdevice ..." 行;unauthorized/offline 不算可用设备
|
|
51
|
+
DEVICE_LINE_RE = re.compile(r"^\S+\s+device\b", re.MULTILINE)
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
def _load_cache():
|
|
@@ -145,6 +147,7 @@ class DevOp:
|
|
|
145
147
|
logd(f"serial = {serial} needroot ={needRoot}")
|
|
146
148
|
|
|
147
149
|
self.adb = adb_path
|
|
150
|
+
self.serial = serial
|
|
148
151
|
self._displays: Optional[List[DisplayInfo]] = None
|
|
149
152
|
self.curScreenW = 0
|
|
150
153
|
self.curScreenH = 0
|
|
@@ -159,8 +162,8 @@ class DevOp:
|
|
|
159
162
|
self.soc = None
|
|
160
163
|
self.chipId = None
|
|
161
164
|
|
|
162
|
-
#
|
|
163
|
-
out
|
|
165
|
+
# 检查设备是否连接(adb server 冷启动较慢,首次易超时)
|
|
166
|
+
out = self._probeDevices()
|
|
164
167
|
cache = _load_cache()
|
|
165
168
|
|
|
166
169
|
# 判断缓存是否命中
|
|
@@ -243,6 +246,30 @@ class DevOp:
|
|
|
243
246
|
except FileNotFoundError:
|
|
244
247
|
return "", "adb not found in PATH"
|
|
245
248
|
|
|
249
|
+
def _probeDevices(self, timeout: int = 10) -> str:
|
|
250
|
+
"""探测已连接设备。adb server 冷启动时,首次调用可能超时,
|
|
251
|
+
也可能 server 已返回但 USB 设备尚未枚举完成(只返回表头),
|
|
252
|
+
因此这里显式等待设备出现,避免第一次执行直接失败。"""
|
|
253
|
+
out, err = self._adb("devices", "-l", timeout=timeout)
|
|
254
|
+
if DEVICE_LINE_RE.search(out) or "unauthorized" in out or "offline" in out:
|
|
255
|
+
return out
|
|
256
|
+
|
|
257
|
+
# 冷启动:先确保 server 就绪,再等待设备枚举
|
|
258
|
+
logw("未发现设备,启动 adb server 并等待设备枚举")
|
|
259
|
+
try:
|
|
260
|
+
subprocess.run([self.adb, "start-server"], capture_output=True, timeout=30)
|
|
261
|
+
except (subprocess.TimeoutExpired, OSError) as e:
|
|
262
|
+
logw(f"adb start-server 失败: {e}")
|
|
263
|
+
|
|
264
|
+
deadline = time.monotonic() + timeout
|
|
265
|
+
while time.monotonic() < deadline:
|
|
266
|
+
time.sleep(0.5)
|
|
267
|
+
out, err = self._adb("devices", "-l", timeout=5)
|
|
268
|
+
if DEVICE_LINE_RE.search(out) or "unauthorized" in out or "offline" in out:
|
|
269
|
+
return out
|
|
270
|
+
loge(f"adb devices -l 未发现可用设备: {err}")
|
|
271
|
+
return out
|
|
272
|
+
|
|
246
273
|
def _adb_shell(self, shell_cmd: str, timeout: int = 10) -> Tuple[str, str]:
|
|
247
274
|
return self._adb("shell", shell_cmd, timeout=timeout)
|
|
248
275
|
|
|
@@ -273,7 +300,7 @@ class DevOp:
|
|
|
273
300
|
|
|
274
301
|
def getConnectedDevices(self):
|
|
275
302
|
try:
|
|
276
|
-
out, error =
|
|
303
|
+
out, error = self._adb("devices", "-l", timeout=5)
|
|
277
304
|
if "offline" in out or "unauthorized" in out:
|
|
278
305
|
tmp = out.split("\n")[1].split(" ")[0]
|
|
279
306
|
eExit(f"{tmp} devices offline or unauthorized")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: taotoolkit
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.4
|
|
4
4
|
Summary: Tao ToolKit
|
|
5
5
|
Author-email: taotaoli <taotaoli@asrmicro.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -19,7 +19,7 @@ Requires-Dist: beautifulsoup4>=4.10.0
|
|
|
19
19
|
Requires-Dist: pyyaml>=6.0.3
|
|
20
20
|
Requires-Dist: pywinpty>=3.0.5; platform_system == "Windows"
|
|
21
21
|
Provides-Extra: uiautomator
|
|
22
|
-
Requires-Dist: uiautomator2>=2.0.
|
|
22
|
+
Requires-Dist: uiautomator2>=2.0.4; extra == "uiautomator"
|
|
23
23
|
|
|
24
24
|
# TAO - Toolkit
|
|
25
25
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|