| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging | 5 import logging |
| 6 import re | 6 import re |
| 7 | 7 |
| 8 from pylib import cmd_helper | 8 from devil.utils import cmd_helper |
| 9 | 9 |
| 10 _INDENTATION_RE = re.compile(r'^( *)') | 10 _INDENTATION_RE = re.compile(r'^( *)') |
| 11 _LSUSB_BUS_DEVICE_RE = re.compile(r'^Bus (\d{3}) Device (\d{3}):') | 11 _LSUSB_BUS_DEVICE_RE = re.compile(r'^Bus (\d{3}) Device (\d{3}):') |
| 12 _LSUSB_ENTRY_RE = re.compile(r'^ *([^ ]+) +([^ ]+) *([^ ].*)?$') | 12 _LSUSB_ENTRY_RE = re.compile(r'^ *([^ ]+) +([^ ]+) *([^ ].*)?$') |
| 13 _LSUSB_GROUP_RE = re.compile(r'^ *([^ ]+.*):$') | 13 _LSUSB_GROUP_RE = re.compile(r'^ *([^ ]+.*):$') |
| 14 | 14 |
| 15 _USBDEVFS_RESET = ord('U') << 8 | 20 | 15 _USBDEVFS_RESET = ord('U') << 8 | 20 |
| 16 | 16 |
| 17 | 17 |
| 18 def lsusb(): | 18 def lsusb(): |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 | 79 |
| 80 def get_lsusb_serial(device): | 80 def get_lsusb_serial(device): |
| 81 return device.get('Device Descriptor', {}).get('iSerial', {}).get('_desc') | 81 return device.get('Device Descriptor', {}).get('iSerial', {}).get('_desc') |
| 82 | 82 |
| 83 | 83 |
| 84 def get_android_devices(): | 84 def get_android_devices(): |
| 85 return [serial for serial in (get_lsusb_serial(d) for d in lsusb()) | 85 return [serial for serial in (get_lsusb_serial(d) for d in lsusb()) |
| 86 if serial] | 86 if serial] |
| 87 | 87 |
| OLD | NEW |