mirror of
https://github.com/ARM-software/devlib.git
synced 2025-02-07 13:40:48 +00:00
utils/android: Try to ping adb devices regardless of connection type
Previously if a device was connected over usb then the adb_connect method would assume the device was already connected. This can cause issues when rebooting and the device is not ready by the time devlib attempts to reconnect to it causing the next command to fail. Now still only execute the 'connect' command when the device is connected over the network, however always trying pinging the device to see if it is connected before returning.
This commit is contained in:
parent
5cafd2ec4d
commit
fe0d6eda2a
@ -317,15 +317,12 @@ def adb_get_device(timeout=None, adb_server=None):
|
|||||||
|
|
||||||
def adb_connect(device, timeout=None, attempts=MAX_ATTEMPTS):
|
def adb_connect(device, timeout=None, attempts=MAX_ATTEMPTS):
|
||||||
_check_env()
|
_check_env()
|
||||||
# Connect is required only for ADB-over-IP
|
|
||||||
if "." not in device:
|
|
||||||
logger.debug('Device connected via USB, connect not required')
|
|
||||||
return
|
|
||||||
tries = 0
|
tries = 0
|
||||||
output = None
|
output = None
|
||||||
while tries <= attempts:
|
while tries <= attempts:
|
||||||
tries += 1
|
tries += 1
|
||||||
if device:
|
if device:
|
||||||
|
if "." in device: # Connect is required only for ADB-over-IP
|
||||||
command = 'adb connect {}'.format(device)
|
command = 'adb connect {}'.format(device)
|
||||||
logger.debug(command)
|
logger.debug(command)
|
||||||
output, _ = check_output(command, shell=True, timeout=timeout)
|
output, _ = check_output(command, shell=True, timeout=timeout)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user