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

Side by Side Diff: build/android/adb_reverse_forwarder.py

Issue 1331213004: [Android] Don't use a device blacklist if one isn't provided. (RELAND 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: + adb_install_apk.py blacklist Created 5 years, 3 months 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 unified diff | Download patch
« no previous file with comments | « build/android/adb_install_apk.py ('k') | build/android/buildbot/bb_device_status_check.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Command line tool for forwarding ports from a device to the host. 7 """Command line tool for forwarding ports from a device to the host.
8 8
9 Allows an Android device to connect to services running on the host machine, 9 Allows an Android device to connect to services running on the host machine,
10 i.e., "adb forward" in reverse. Requires |host_forwarder| and |device_forwarder| 10 i.e., "adb forward" in reverse. Requires |host_forwarder| and |device_forwarder|
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 parser.error('Need even number of port pairs') 48 parser.error('Need even number of port pairs')
49 sys.exit(1) 49 sys.exit(1)
50 50
51 try: 51 try:
52 port_pairs = [int(a) for a in args[1:]] 52 port_pairs = [int(a) for a in args[1:]]
53 port_pairs = zip(port_pairs[::2], port_pairs[1::2]) 53 port_pairs = zip(port_pairs[::2], port_pairs[1::2])
54 except ValueError: 54 except ValueError:
55 parser.error('Bad port number') 55 parser.error('Bad port number')
56 sys.exit(1) 56 sys.exit(1)
57 57
58 if options.blacklist_file: 58 blacklist = (device_blacklist.Blacklist(options.blacklist_file)
59 blacklist = device_blacklist.Blacklist(options.blacklist_file) 59 if options.blacklist_file
60 else: 60 else None)
61 blacklist = None
62
63 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) 61 devices = device_utils.DeviceUtils.HealthyDevices(blacklist)
64 62
65 if options.device: 63 if options.device:
66 device = next((d for d in devices if d == options.device), None) 64 device = next((d for d in devices if d == options.device), None)
67 if not device: 65 if not device:
68 raise device_errors.DeviceUnreachableError(options.device) 66 raise device_errors.DeviceUnreachableError(options.device)
69 elif devices: 67 elif devices:
70 device = devices[0] 68 device = devices[0]
71 logging.info('No device specified. Defaulting to %s', devices[0]) 69 logging.info('No device specified. Defaulting to %s', devices[0])
72 else: 70 else:
73 raise device_errors.NoDevicesError() 71 raise device_errors.NoDevicesError()
74 72
75 constants.SetBuildType(options.build_type) 73 constants.SetBuildType(options.build_type)
76 try: 74 try:
77 forwarder.Forwarder.Map(port_pairs, device) 75 forwarder.Forwarder.Map(port_pairs, device)
78 while True: 76 while True:
79 time.sleep(60) 77 time.sleep(60)
80 except KeyboardInterrupt: 78 except KeyboardInterrupt:
81 sys.exit(0) 79 sys.exit(0)
82 finally: 80 finally:
83 forwarder.Forwarder.UnmapAllDevicePorts(device) 81 forwarder.Forwarder.UnmapAllDevicePorts(device)
84 82
85 if __name__ == '__main__': 83 if __name__ == '__main__':
86 main(sys.argv) 84 main(sys.argv)
OLDNEW
« no previous file with comments | « build/android/adb_install_apk.py ('k') | build/android/buildbot/bb_device_status_check.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698