优化:调整WiFi ADB连接逻辑,支持ip:port格式;改进USB设备选择逻辑,增强连接稳定性
This commit is contained in:
1 parent
4903e50ff2
commit
d057c1d84e
3 files changed
+52
-23
No files matched your search
@@ -43,12 +43,18 @@ def choose_targets(adb_exe: str, device_arg: str | None, all_flag: bool) -> List
|
||||
return [device_arg]
|
||||
|
||||
if all_flag:
|
||||
return usb_devices
|
||||
# 对所有 USB 设备尝试;如果没有 USB 设备但存在已连接的 WiFi 设备,则也尝试这些 WiFi 设备
|
||||
if usb_devices:
|
||||
return usb_devices
|
||||
return wifi
|
||||
|
||||
# 默认行为:如果只有一个 USB 设备则选择它;否则提示用户
|
||||
if len(usb_devices) == 1:
|
||||
return [usb_devices[0]]
|
||||
if len(usb_devices) == 0:
|
||||
# 没有 USB 设备:如果有已连接的 WiFi 设备则回退到它们(便于仅通过 WiFi 的场景),否则返回空
|
||||
if wifi:
|
||||
return wifi
|
||||
return []
|
||||
raise ValueError(
|
||||
"检测到多个 USB 设备,请使用 --device 指定或者加上 --all 来对所有设备同时尝试"
|
||||
|
||||
Reference in new issue
Block a user