Chromium Code Reviews| Index: build/android/adb_reverse_forwarder.py |
| diff --git a/build/android/adb_reverse_forwarder.py b/build/android/adb_reverse_forwarder.py |
| index 700e4e96b274a1ff1a3e50dcff6cb69e51bdff7a..16a383df3d02cae01c9533dbad597d6ca7ee523f 100755 |
| --- a/build/android/adb_reverse_forwarder.py |
| +++ b/build/android/adb_reverse_forwarder.py |
| @@ -15,6 +15,7 @@ import optparse |
| import sys |
| import time |
| +from pylib import android_commands |
| from pylib import constants, forwarder |
| from pylib.device import device_utils |
| from pylib.utils import run_tests_helper |
| @@ -50,7 +51,20 @@ def main(argv): |
| parser.error('Bad port number') |
| sys.exit(1) |
| - device = device_utils.DeviceUtils(options.device) |
| + devices = android_commands.GetAttachedDevices() |
| + |
| + if options.device: |
| + if options.device not in devices: |
| + raise Exception('Error: %s not in attached devices %s' % (options.device, |
| + ','.join(devices))) |
| + devices = [options.device] |
| + |
| + if not devices: |
|
jbudorick
2014/11/03 23:22:50
nit: shuffle this around a little s.t. you print t
danduong
2014/11/04 00:21:47
Done.
|
| + raise Exception('Error: no connected devices') |
| + if len(devices) > 1: |
| + print("No device specified. Defaulting to " + devices[0]) |
| + |
| + device = device_utils.DeviceUtils(devices[0]) |
| constants.SetBuildType(options.build_type) |
| try: |
| forwarder.Forwarder.Map(port_pairs, device) |