Chromium Code Reviews| 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..fa6c3d41beeff70a5c5bac1b98477f247c329586 |
| --- /dev/null |
| +++ b/devil/devil/utils/update_mapping.py |
| @@ -0,0 +1,38 @@ |
| +#!/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 find_usb_devices |
| + |
| +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' |
|
rnephew (Reviews Here)
2016/03/30 14:39:54
Should the description also include a description
alexandermont
2016/03/30 23:35:53
Done
|
| + 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', '--hubs', dest='hub_types', |
| + default='plugable_7port', type=str, |
| + action='store', help='List of usb hub types. ' |
| + 'Supported types:' |
| + ' plugable_7port = Plugable 7-Port Hub') |
| + options = parser.parse_args() |
| + options.hub_types = options.hub_types.split(',') |
| + return options |
| + |
| +def main(): |
| + options = parse_options() |
| + find_usb_devices.GenerateSerialMapFile(options.out_file, options.hub_types) |
| + |
| +if __name__ == "__main__": |
| + sys.exit(main()) |