Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1644)

Unified Diff: build/android/adb_reverse_forwarder.py

Issue 684383004: If no device specified, get the first device found (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c1d9551542409a8ef97fb8e98020c78324abbc7f 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,19 @@ 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]
+ else:
+ if not devices:
+ raise Exception('Error: no connected devices')
+ 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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698