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

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

Issue 1315743004: [Android] Add a custom pylintrc for build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix appurify_sanitized import-errors Created 5 years, 3 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
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 argparse
6 import fcntl
7 import logging 5 import logging
8 import re 6 import re
9 import sys
10 7
11 from pylib import cmd_helper 8 from pylib import cmd_helper
12 from pylib.device import adb_wrapper
13 from pylib.device import device_errors
14 from pylib.utils import run_tests_helper
15 9
16 _INDENTATION_RE = re.compile(r'^( *)') 10 _INDENTATION_RE = re.compile(r'^( *)')
17 _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}):')
18 _LSUSB_ENTRY_RE = re.compile(r'^ *([^ ]+) +([^ ]+) *([^ ].*)?$') 12 _LSUSB_ENTRY_RE = re.compile(r'^ *([^ ]+) +([^ ]+) *([^ ].*)?$')
19 _LSUSB_GROUP_RE = re.compile(r'^ *([^ ]+.*):$') 13 _LSUSB_GROUP_RE = re.compile(r'^ *([^ ]+.*):$')
20 14
21 _USBDEVFS_RESET = ord('U') << 8 | 20 15 _USBDEVFS_RESET = ord('U') << 8 | 20
22 16
23 17
24 def lsusb(): 18 def lsusb():
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 78
85 79
86 def get_lsusb_serial(device): 80 def get_lsusb_serial(device):
87 return device.get('Device Descriptor', {}).get('iSerial', {}).get('_desc') 81 return device.get('Device Descriptor', {}).get('iSerial', {}).get('_desc')
88 82
89 83
90 def get_android_devices(): 84 def get_android_devices():
91 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())
92 if serial] 86 if serial]
93 87
OLDNEW
« no previous file with comments | « build/android/devil/base_error.py ('k') | build/android/devil/utils/reraiser_thread_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698