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

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

Issue 1306653005: Revert of [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 blacklist = (device_blacklist.Blacklist(options.blacklist_file) 59 if options.blacklist_file:
60 if options.blacklist_file 60 blacklist = device_blacklist.Blacklist(options.blacklist_file)
61 else None) 61 else:
62 blacklist = None
63
62 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) 64 devices = device_utils.DeviceUtils.HealthyDevices(blacklist)
63 65
64 if options.device: 66 if options.device:
65 device = next((d for d in devices if d == options.device), None) 67 device = next((d for d in devices if d == options.device), None)
66 if not device: 68 if not device:
67 raise device_errors.DeviceUnreachableError(options.device) 69 raise device_errors.DeviceUnreachableError(options.device)
68 elif devices: 70 elif devices:
69 device = devices[0] 71 device = devices[0]
70 logging.info('No device specified. Defaulting to %s', devices[0]) 72 logging.info('No device specified. Defaulting to %s', devices[0])
71 else: 73 else:
72 raise device_errors.NoDevicesError() 74 raise device_errors.NoDevicesError()
73 75
74 constants.SetBuildType(options.build_type) 76 constants.SetBuildType(options.build_type)
75 try: 77 try:
76 forwarder.Forwarder.Map(port_pairs, device) 78 forwarder.Forwarder.Map(port_pairs, device)
77 while True: 79 while True:
78 time.sleep(60) 80 time.sleep(60)
79 except KeyboardInterrupt: 81 except KeyboardInterrupt:
80 sys.exit(0) 82 sys.exit(0)
81 finally: 83 finally:
82 forwarder.Forwarder.UnmapAllDevicePorts(device) 84 forwarder.Forwarder.UnmapAllDevicePorts(device)
83 85
84 if __name__ == '__main__': 86 if __name__ == '__main__':
85 main(sys.argv) 87 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