增加健壮度。修复wda无法启动的bug。
This commit is contained in:
31
.idea/workspace.xml
generated
31
.idea/workspace.xml
generated
@@ -6,7 +6,36 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="eceeff5e-51c1-459c-a911-d21ec090a423" name="Changes" comment="20250904-初步功能已完成">
|
<list default="true" id="eceeff5e-51c1-459c-a911-d21ec090a423" name="Changes" comment="20250904-初步功能已完成">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Module/DeviceInfo.py" beforeDir="false" afterPath="$PROJECT_DIR$/Module/DeviceInfo.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Module/Main.py" beforeDir="false" afterPath="$PROJECT_DIR$/Module/Main.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevice_id.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevice_id.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicebackup.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicebackup.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicebackup2.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicebackup2.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicebtlogger.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicebtlogger.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicecrashreport.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicecrashreport.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicedate.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicedate.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicedebug.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicedebug.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicedebugserverproxy.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicedebugserverproxy.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicedevmodectl.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicedevmodectl.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicediagnostics.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicediagnostics.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/ideviceenterrecovery.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/ideviceenterrecovery.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/ideviceimagemounter.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/ideviceimagemounter.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/ideviceinfo.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/ideviceinfo.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicename.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicename.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicenotificationproxy.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicenotificationproxy.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicepair.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicepair.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/ideviceprovision.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/ideviceprovision.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicerestore.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicerestore.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicescreenshot.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicescreenshot.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicesetlocation.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicesetlocation.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/idevicesyslog.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/idevicesyslog.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/inetcat.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/inetcat.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/irecovery.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/irecovery.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/libcrypto-3.dll" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/libcrypto-3.dll" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/libcurl.dll" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/libcurl.dll" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/libssl-3.dll" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/libssl-3.dll" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/plistutil.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/plistutil.exe" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/readline.dll" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/readline.dll" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/resources/iproxy/tidevice.exe" beforeDir="false" afterPath="$PROJECT_DIR$/resources/iproxy/tidevice.exe" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -147,13 +147,15 @@ class Deviceinfo(object):
|
|||||||
if new_udids:
|
if new_udids:
|
||||||
futures = {self._connect_pool.submit(self._connect_device_task, udid): udid
|
futures = {self._connect_pool.submit(self._connect_device_task, udid): udid
|
||||||
for udid in new_udids}
|
for udid in new_udids}
|
||||||
for f in as_completed(futures, timeout=10):
|
try:
|
||||||
udid = futures[f]
|
for f in as_completed(futures, timeout=30):
|
||||||
try:
|
udid = futures[f]
|
||||||
f.result(timeout=8) # 单台 8 s 硬截止
|
try:
|
||||||
except Exception as e:
|
f.result(timeout=8)
|
||||||
LogManager.error(f"连接任务超时/失败: {e}", udid)
|
except Exception as e:
|
||||||
|
LogManager.error(text=f"连接任务失败:{e}", udid=udid)
|
||||||
|
except TimeoutError:
|
||||||
|
LogManager.warning(text="部分设备连接超时,已跳过")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
@@ -313,6 +315,12 @@ class Deviceinfo(object):
|
|||||||
self._port_in_use.remove(port)
|
self._port_in_use.remove(port)
|
||||||
self._port_pool.append(port)
|
self._port_pool.append(port)
|
||||||
|
|
||||||
|
# 检测usb是否超时
|
||||||
|
def _usb_client_with_timeout(self,udid: str, timeout: 8):
|
||||||
|
with ThreadPoolExecutor(max_workers=1) as exe:
|
||||||
|
fut = exe.submit(wda.USBClient, udid, 8100)
|
||||||
|
return fut.result(timeout=timeout)
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# 线程池里真正干活的地方(原 connectDevice 逻辑搬过来)
|
# 线程池里真正干活的地方(原 connectDevice 逻辑搬过来)
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
@@ -320,6 +328,12 @@ class Deviceinfo(object):
|
|||||||
if not self.is_device_trusted(udid):
|
if not self.is_device_trusted(udid):
|
||||||
LogManager.warning("设备未信任,跳过 WDA 启动", udid)
|
LogManager.warning("设备未信任,跳过 WDA 启动", udid)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
d = self._usb_client_with_timeout(udid, 8) # 8 秒必返
|
||||||
|
if d is None:
|
||||||
|
LogManager.info(f"设备链接超时,{udid}")
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
d = wda.USBClient(udid, 8100)
|
d = wda.USBClient(udid, 8100)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -36,11 +36,14 @@ if __name__ == "__main__":
|
|||||||
manager.start()
|
manager.start()
|
||||||
|
|
||||||
# 设备监听(即使失败/很快返回,也不会导致主进程退出)
|
# 设备监听(即使失败/很快返回,也不会导致主进程退出)
|
||||||
try:
|
# try:
|
||||||
info = Deviceinfo()
|
# info = Deviceinfo()
|
||||||
info.startDeviceListener()
|
# info.startDeviceListener()
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
print("[WARN] Device listener not running:", e)
|
# print("[WARN] Device listener not running:", e)
|
||||||
|
|
||||||
|
info = Deviceinfo()
|
||||||
|
info.startDeviceListener()
|
||||||
|
|
||||||
# === 保活:阻塞主线程,直到收到 Ctrl+C/关闭 ===
|
# === 保活:阻塞主线程,直到收到 Ctrl+C/关闭 ===
|
||||||
import threading, time, signal
|
import threading, time, signal
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
18
build.bat
18
build.bat
@@ -1,24 +1,18 @@
|
|||||||
python -m nuitka "C:\Users\zhangkai\Desktop\20250916ios\iOSAI\Module\Main.py" ^
|
python -m nuitka "Module/Main.py" ^
|
||||||
--standalone ^
|
--standalone ^
|
||||||
--msvc=latest ^
|
--msvc=latest ^
|
||||||
--windows-console-mode=disable ^
|
--windows-console-mode=force ^
|
||||||
--remove-output ^
|
|
||||||
--output-dir="C:\Users\zhangkai\Desktop\20250916ios\iOSAI\out" ^
|
|
||||||
--output-filename=IOSAI ^
|
--output-filename=IOSAI ^
|
||||||
--include-package=Module,Utils,Entity,script ^
|
--include-package=Module,Utils,Entity,script ^
|
||||||
--include-module=flask ^
|
--include-module=flask ^
|
||||||
--include-module=flask_cors ^
|
--include-module=flask_cors ^
|
||||||
--include-module=jinja2 ^
|
|
||||||
--include-module=werkzeug ^
|
|
||||||
--include-module=cv2 ^
|
|
||||||
--include-module=numpy ^
|
|
||||||
--include-module=lxml ^
|
--include-module=lxml ^
|
||||||
--include-module=lxml.etree ^
|
--include-module=lxml.etree ^
|
||||||
--include-module=requests ^
|
--include-module=requests ^
|
||||||
--include-module=urllib3 ^
|
--include-module=urllib3 ^
|
||||||
--include-module=certifi ^
|
--include-module=certifi ^
|
||||||
--include-module=idna ^
|
--include-module=idna ^
|
||||||
--include-data-dir="C:\Users\zhangkai\Desktop\20250916ios\iOSAI\SupportFiles=SupportFiles" ^
|
--include-data-dir="E:/code/Python/iOSAI/SupportFiles=SupportFiles" ^
|
||||||
--include-data-dir="C:\Users\zhangkai\Desktop\20250916ios\iOSAI\resources=resources" ^
|
--include-data-dir="E:/code/Python/iOSAI/resources=resources" ^
|
||||||
--include-data-files="C:\Users\zhangkai\Desktop\20250916ios\iOSAI\resources\iproxy\*=resources/iproxy/" ^
|
--include-data-files="E:/code/Python/iOSAI/resources/iproxy/*=resources/iproxy/" ^
|
||||||
--windows-icon-from-ico="C:\Users\zhangkai\Desktop\20250916ios\iOSAI\resources\icon.ico"
|
--windows-icon-from-ico="E:/code/Python/iOSAI/resources/icon.ico"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user