1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

android: don't try to disconnect devices which aren't connected

If you try to disconnect a device and there are none, certain versions
of adb return 1, which leads to a TargetError and stops everything in
its tracks.

Try to mitigate this by checking if the device we want to disconnect is
connected before we make the disconnect call.

Signed-off-by: Chris Redpath <chris.redpath@arm.com>
This commit is contained in:
Chris Redpath 2016-10-06 16:34:14 +01:00
parent cae239d1dc
commit 119fd7dc24

View File

@ -291,7 +291,7 @@ def adb_disconnect(device):
_check_env()
if not device:
return
if ":" in device:
if ":" in device and device in adb_list_devices():
command = "adb disconnect " + device
logger.debug(command)
retval = subprocess.call(command, stdout=open(os.devnull, 'wb'), shell=True)