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

Unified Diff: devil/devil/utils/update_mapping.py

Issue 1823193002: add GetBattorPathFromPhoneSerial to find_usb_devices (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: fix test Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « devil/devil/utils/test/data/test_serial_map.json ('k') | devil/devil/utils/usb_hubs.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/utils/update_mapping.py
diff --git a/devil/devil/utils/update_mapping.py b/devil/devil/utils/update_mapping.py
new file mode 100755
index 0000000000000000000000000000000000000000..c49a5f80b540887952748ed4016430b03d2dfa73
--- /dev/null
+++ b/devil/devil/utils/update_mapping.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import argparse
+import sys
+
+from devil.utils import battor_device_mapping
+
+def parse_options():
+ """Parses and checks the command-line options.
+
+ Returns:
+ A tuple containing the options structure.
+ """
+ usage = 'Usage: ./update_mapping.py [options]'
+ desc = ('Example: ./update_mapping.py -o mapping.json.\n'
+ 'This script generates and stores a file that gives the\n'
+ 'mapping between phone serial numbers and BattOr serial numbers\n'
+ 'Mapping is based on which physical ports on the USB hubs the\n'
+ 'devices are plugged in to. For instance, if there are two hubs,\n'
+ 'the phone connected to port N on the first hub is mapped to the\n'
+ 'BattOr connected to port N on the second hub, for each N.')
+ parser = argparse.ArgumentParser(usage=usage, description=desc)
+ parser.add_argument('-o', '--output', dest='out_file',
+ default='mapping.json', type=str,
+ action='store', help='mapping file name')
+ parser.add_argument('-u', '--hub', dest='hub_types',
+ action='append', choices=['plugable_7port'],
+ help='USB hub types.')
+ options = parser.parse_args()
+ if not options.hub_types:
+ options.hub_types = ['plugable_7port']
+ return options
+
+def main():
+ options = parse_options()
+ battor_device_mapping.GenerateSerialMapFile(options.out_file,
+ options.hub_types)
+
+if __name__ == "__main__":
+ sys.exit(main())
« no previous file with comments | « devil/devil/utils/test/data/test_serial_map.json ('k') | devil/devil/utils/usb_hubs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698