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