mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-13 00:57:01 +08:00
@@ -294,11 +294,21 @@ class Connection(ConnectionAttr):
|
||||
Returns:
|
||||
list[str]: ['nc'] or ['busybox', 'nc']
|
||||
"""
|
||||
# Android 9 emulators does not have `nc`, try `busybox nc`
|
||||
trial = [
|
||||
['nc'],
|
||||
['busybox', 'nc'],
|
||||
]
|
||||
sdk = self.adb_shell(['getprop', 'ro.build.version.sdk'])
|
||||
sdk = int(sdk)
|
||||
logger.info(f'sdk_ver: {sdk}')
|
||||
if sdk >= 28:
|
||||
# Android 9 emulators does not have `nc`, try `busybox nc`
|
||||
# BlueStacks Pie (Android 9) has `nc` but cannot send data, try `busybox nc` first
|
||||
trial = [
|
||||
['busybox', 'nc'],
|
||||
['nc'],
|
||||
]
|
||||
else:
|
||||
trial = [
|
||||
['nc'],
|
||||
['busybox', 'nc'],
|
||||
]
|
||||
for command in trial:
|
||||
# About 3ms
|
||||
result = self.adb_shell(command)
|
||||
|
||||
@@ -54,6 +54,8 @@ def recv_all(stream, chunk_size=4096, recv_interval=0.000) -> bytes:
|
||||
if isinstance(stream, _AdbStreamConnection):
|
||||
stream = stream.conn
|
||||
stream.settimeout(10)
|
||||
else:
|
||||
stream.settimeout(10)
|
||||
|
||||
try:
|
||||
fragments = []
|
||||
|
||||
Reference in New Issue
Block a user