mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-01 03:30:35 +08:00
Pref: Try nc command on android phones first
This commit is contained in:
@@ -378,10 +378,11 @@ class Connection(ConnectionAttr):
|
|||||||
Returns:
|
Returns:
|
||||||
list[str]: ['nc'] or ['busybox', 'nc']
|
list[str]: ['nc'] or ['busybox', 'nc']
|
||||||
"""
|
"""
|
||||||
|
if self.is_emulator:
|
||||||
sdk = self.sdk_ver
|
sdk = self.sdk_ver
|
||||||
logger.info(f'sdk_ver: {sdk}')
|
logger.info(f'sdk_ver: {sdk}')
|
||||||
if sdk >= 28:
|
if sdk >= 28:
|
||||||
# Android 9 emulators does not have `nc`, try `busybox nc`
|
# LD Player 9 does not have `nc`, try `busybox nc`
|
||||||
# BlueStacks Pie (Android 9) has `nc` but cannot send data, try `busybox nc` first
|
# BlueStacks Pie (Android 9) has `nc` but cannot send data, try `busybox nc` first
|
||||||
trial = [
|
trial = [
|
||||||
['busybox', 'nc'],
|
['busybox', 'nc'],
|
||||||
@@ -392,10 +393,16 @@ class Connection(ConnectionAttr):
|
|||||||
['nc'],
|
['nc'],
|
||||||
['busybox', 'nc'],
|
['busybox', 'nc'],
|
||||||
]
|
]
|
||||||
|
else:
|
||||||
|
trial = [
|
||||||
|
['nc'],
|
||||||
|
['busybox', 'nc'],
|
||||||
|
]
|
||||||
for command in trial:
|
for command in trial:
|
||||||
# About 3ms
|
# About 3ms
|
||||||
result = self.adb_shell(command)
|
|
||||||
# Result should be command help if success
|
# Result should be command help if success
|
||||||
|
# nc: bad argument count (see "nc --help")
|
||||||
|
result = self.adb_shell(command)
|
||||||
# `/system/bin/sh: nc: not found`
|
# `/system/bin/sh: nc: not found`
|
||||||
if 'not found' in result:
|
if 'not found' in result:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user