From aab7690b6ed50129a4236a2b1d346b9944a478d1 Mon Sep 17 00:00:00 2001 From: Huizi Yang Date: Thu, 14 Oct 2021 12:11:46 -0700 Subject: vm/adb: add localhost to ip regex of device remote_device_proxy uses localhost for Android WFH connection. --- vm/adb/adb.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vm/adb/adb.go b/vm/adb/adb.go index 624fd7efc..f3efb7beb 100644 --- a/vm/adb/adb.go +++ b/vm/adb/adb.go @@ -69,7 +69,7 @@ type instance struct { var ( androidSerial = "^[0-9A-Z]+$" - cuttlefishID = `^(?:[0-9]{1,3}\.){3}[0-9]{1,3}\:(?:[0-9]{1,5})$` // IP:port + ipAddress = `^(?:localhost|(?:[0-9]{1,3}\.){3}[0-9]{1,3})\:(?:[0-9]{1,5})$` // cuttlefish or remote_device_proxy ) func loadDevice(data []byte) (*Device, error) { @@ -102,7 +102,7 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) { return nil, fmt.Errorf("no adb devices specified") } // Device should be either regular serial number, or a valid Cuttlefish ID. - devRe := regexp.MustCompile(fmt.Sprintf("%s|%s", androidSerial, cuttlefishID)) + devRe := regexp.MustCompile(fmt.Sprintf("%s|%s", androidSerial, ipAddress)) for _, dev := range cfg.Devices { device, err := loadDevice(dev) if err != nil { -- cgit mrf-deployment