mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-22 15:13:45 +08:00
Fix: Add ADB connection retry
This commit is contained in:
@@ -80,13 +80,14 @@ class Connection:
|
|||||||
self.adb_command(cmd, serial)
|
self.adb_command(cmd, serial)
|
||||||
|
|
||||||
def _adb_connect(self, serial):
|
def _adb_connect(self, serial):
|
||||||
if serial.startswith('127.0.0.1'):
|
for _ in range(3):
|
||||||
msg = self.adb_command(['connect', serial]).decode("utf-8")
|
msg = self.adb_command(['connect', serial]).decode("utf-8").strip()
|
||||||
if msg.startswith('unable'):
|
logger.info(msg)
|
||||||
logger.error('Unable to connect %s' % serial)
|
if 'already' in msg:
|
||||||
exit(1)
|
return True
|
||||||
else:
|
|
||||||
logger.info(msg.strip())
|
logger.warning(f'Failed to connect {serial} after 3 trial.')
|
||||||
|
return False
|
||||||
|
|
||||||
def connect(self, serial):
|
def connect(self, serial):
|
||||||
"""Connect to a device.
|
"""Connect to a device.
|
||||||
|
|||||||
Reference in New Issue
Block a user