修复bug

This commit is contained in:
zw
2025-09-04 20:47:14 +08:00
parent b514b7c329
commit 0d9fa81992
4 changed files with 38 additions and 37 deletions

View File

@@ -10,7 +10,7 @@ import subprocess
from pathlib import Path
from typing import List, Dict, Optional
from tidevice import Usbmux
from tidevice import Usbmux, ConnectionType
from Entity.DeviceModel import DeviceModel
from Entity.Variables import WdaAppBundleId
from Module.FlaskSubprocessManager import FlaskSubprocessManager
@@ -110,13 +110,15 @@ class Deviceinfo(object):
continue
# 新接入设备
for device in lists:
if (device not in self.deviceArray) and (len(self.deviceArray) < self.maxDeviceCount):
# usb设备并且为新设备。并且大于总限制数量
if device.conn_type == ConnectionType.USB and (device not in self.deviceArray) and (len(self.deviceArray) < self.maxDeviceCount):
self.screenProxy += 1
try:
self.connectDevice(device.udid)
self.deviceArray.append(device)
except Exception as e:
LogManager.error(f"连接设备失败 {device.udid}: {e}", device.udid)
# 拔出设备处理
self._removeDisconnected(lists)
time.sleep(1)
@@ -126,9 +128,9 @@ class Deviceinfo(object):
# ----------------------------
def connectDevice(self, identifier: str):
# 1) 连接 WDAUSBClient -> 设备 8100
try:
d = wda.USBClient(identifier, 8100)
LogManager.info("启动 WDA 成功", identifier)
except Exception as e:
LogManager.error(f"启动 WDA 失败请检查手机是否已信任、WDA 是否正常。错误: {e}", identifier)