GetDevices: Also allow `\.` to be part of the host name
authorNicolas Boichat <drinkcat@google.com>
Wed, 30 Nov 2016 04:14:52 +0000 (12:14 +0800)
committerNicolas Boichat <drinkcat@google.com>
Wed, 30 Nov 2016 04:18:35 +0000 (12:18 +0800)
Useful when connecting over TCP to a device with a given IP.

Change-Id: Ibe3b75e5ba3ab0ff90219bb31d45e21d8f5fd61b

android/scripts/common.py

index c7f3dc8..dfc3a8b 100644 (file)
@@ -173,7 +173,7 @@ def getDevices (adb):
        if proc.returncode != 0:
                raise Exception("adb devices -l failed, got %d" % proc.returncode)
 
-       ptrn = re.compile(r'^([a-zA-Z0-9:]+)\s+.*product:([^\s]+)\s+model:([^\s]+)\s+device:([^\s]+)')
+       ptrn = re.compile(r'^([a-zA-Z0-9\.:]+)\s+.*product:([^\s]+)\s+model:([^\s]+)\s+device:([^\s]+)')
        devices = []
        for line in stdout.splitlines()[1:]:
                if len(line.strip()) == 0: