OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import argparse | 6 import argparse |
7 import fcntl | 7 import fcntl |
8 import logging | 8 import logging |
9 import re | 9 import re |
10 import sys | 10 import sys |
11 | 11 |
12 from pylib import cmd_helper | 12 from devil.android import device_errors |
13 from pylib.device import adb_wrapper | 13 from devil.android.sdk import adb_wrapper |
14 from pylib.device import device_errors | 14 from devil.utils import cmd_helper |
15 from pylib.utils import run_tests_helper | 15 from devil.utils import run_tests_helper |
16 | 16 |
17 _INDENTATION_RE = re.compile(r'^( *)') | 17 _INDENTATION_RE = re.compile(r'^( *)') |
18 _LSUSB_BUS_DEVICE_RE = re.compile(r'^Bus (\d{3}) Device (\d{3}):') | 18 _LSUSB_BUS_DEVICE_RE = re.compile(r'^Bus (\d{3}) Device (\d{3}):') |
19 _LSUSB_ENTRY_RE = re.compile(r'^ *([^ ]+) +([^ ]+) *([^ ].*)?$') | 19 _LSUSB_ENTRY_RE = re.compile(r'^ *([^ ]+) +([^ ]+) *([^ ].*)?$') |
20 _LSUSB_GROUP_RE = re.compile(r'^ *([^ ]+.*):$') | 20 _LSUSB_GROUP_RE = re.compile(r'^ *([^ ]+.*):$') |
21 | 21 |
22 _USBDEVFS_RESET = ord('U') << 8 | 20 | 22 _USBDEVFS_RESET = ord('U') << 8 | 20 |
23 | 23 |
24 | 24 |
25 def reset_usb(bus, device): | 25 def reset_usb(bus, device): |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 else: | 158 else: |
159 parser.error('Unable to determine target. ' | 159 parser.error('Unable to determine target. ' |
160 'Specify --serial or BOTH --bus and --device.') | 160 'Specify --serial or BOTH --bus and --device.') |
161 | 161 |
162 return 0 | 162 return 0 |
163 | 163 |
164 | 164 |
165 if __name__ == '__main__': | 165 if __name__ == '__main__': |
166 sys.exit(main()) | 166 sys.exit(main()) |
167 | 167 |
OLD | NEW |