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

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

Issue 1314823011: [Android] Don't use a device blacklist if one isn't provided. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 parser.error('Need even number of port pairs') 49 parser.error('Need even number of port pairs')
50 sys.exit(1) 50 sys.exit(1)
51 51
52 try: 52 try:
53 port_pairs = map(int, args[1:]) 53 port_pairs = map(int, args[1:])
54 port_pairs = zip(port_pairs[::2], port_pairs[1::2]) 54 port_pairs = zip(port_pairs[::2], port_pairs[1::2])
55 except ValueError: 55 except ValueError:
56 parser.error('Bad port number') 56 parser.error('Bad port number')
57 sys.exit(1) 57 sys.exit(1)
58 58
59 if options.blacklist_file: 59 blacklist = (device_blacklist.Blacklist(options.blacklist_file)
60 blacklist = device_blacklist.Blacklist(options.blacklist_file) 60 if options.blacklist_file
61 else: 61 else None)
62 blacklist = None
63
64 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) 62 devices = device_utils.DeviceUtils.HealthyDevices(blacklist)
65 63
66 if options.device: 64 if options.device:
67 device = next((d for d in devices if d == options.device), None) 65 device = next((d for d in devices if d == options.device), None)
68 if not device: 66 if not device:
69 raise device_errors.DeviceUnreachableError(options.device) 67 raise device_errors.DeviceUnreachableError(options.device)
70 elif devices: 68 elif devices:
71 device = devices[0] 69 device = devices[0]
72 logging.info('No device specified. Defaulting to %s', devices[0]) 70 logging.info('No device specified. Defaulting to %s', devices[0])
73 else: 71 else:
74 raise device_errors.NoDevicesError() 72 raise device_errors.NoDevicesError()
75 73
76 constants.SetBuildType(options.build_type) 74 constants.SetBuildType(options.build_type)
77 try: 75 try:
78 forwarder.Forwarder.Map(port_pairs, device) 76 forwarder.Forwarder.Map(port_pairs, device)
79 while True: 77 while True:
80 time.sleep(60) 78 time.sleep(60)
81 except KeyboardInterrupt: 79 except KeyboardInterrupt:
82 sys.exit(0) 80 sys.exit(0)
83 finally: 81 finally:
84 forwarder.Forwarder.UnmapAllDevicePorts(device) 82 forwarder.Forwarder.UnmapAllDevicePorts(device)
85 83
86 if __name__ == '__main__': 84 if __name__ == '__main__':
87 main(sys.argv) 85 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