mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 08:37:42 +00:00
Pref: Try nc command on android phones first
This commit is contained in:
parent
888cb029ff
commit
1d6eff5dff
@ -385,15 +385,21 @@ class Connection(ConnectionAttr):
|
|||||||
Returns:
|
Returns:
|
||||||
list[str]: ['nc'] or ['busybox', 'nc']
|
list[str]: ['nc'] or ['busybox', 'nc']
|
||||||
"""
|
"""
|
||||||
sdk = self.sdk_ver
|
if self.is_emulator:
|
||||||
logger.info(f'sdk_ver: {sdk}')
|
sdk = self.sdk_ver
|
||||||
if sdk >= 28:
|
logger.info(f'sdk_ver: {sdk}')
|
||||||
# Android 9 emulators does not have `nc`, try `busybox nc`
|
if sdk >= 28:
|
||||||
# BlueStacks Pie (Android 9) has `nc` but cannot send data, try `busybox nc` first
|
# LD Player 9 does not have `nc`, try `busybox nc`
|
||||||
trial = [
|
# BlueStacks Pie (Android 9) has `nc` but cannot send data, try `busybox nc` first
|
||||||
['busybox', 'nc'],
|
trial = [
|
||||||
['nc'],
|
['busybox', 'nc'],
|
||||||
]
|
['nc'],
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
trial = [
|
||||||
|
['nc'],
|
||||||
|
['busybox', 'nc'],
|
||||||
|
]
|
||||||
else:
|
else:
|
||||||
trial = [
|
trial = [
|
||||||
['nc'],
|
['nc'],
|
||||||
@ -401,8 +407,9 @@ class Connection(ConnectionAttr):
|
|||||||
]
|
]
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user