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

Side by Side Diff: build/android/devil/utils/lsusb.py

Issue 1316413003: [Android] Add a configurable environment for devil/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 2 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/devil/devil_env.py ('k') | build/android/devil/utils/mock_calls.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 # 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
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
OLDNEW
« no previous file with comments | « build/android/devil/devil_env.py ('k') | build/android/devil/utils/mock_calls.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698