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

Unified Diff: devil/devil/android/tools/device_recovery.py

Issue 2320683002: [devil] Reenable USB reset in device_recovery behind a flag. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/android/tools/device_recovery.py
diff --git a/devil/devil/android/tools/device_recovery.py b/devil/devil/android/tools/device_recovery.py
index 4852814a1b5840c2865fd1d2251466e6ac9f216b..a7844e262eabcacd6b8cf5599876ff319f2816db 100755
--- a/devil/devil/android/tools/device_recovery.py
+++ b/devil/devil/android/tools/device_recovery.py
@@ -102,7 +102,7 @@ def RecoverDevice(device, blacklist, should_reboot=lambda device: True):
reason='reboot_timeout')
-def RecoverDevices(devices, blacklist):
+def RecoverDevices(devices, blacklist, enable_usb_reset=False):
"""Attempts to recover any inoperable devices in the provided list.
Args:
@@ -143,8 +143,11 @@ def RecoverDevices(devices, blacklist):
try:
# TODO(crbug.com/642194): Resetting may be causing more harm
# (specifically, kernel panics) than it does good.
- logging.warning('USB reset disabled for %s (crbug.com/642914)',
- serial)
+ if enable_usb_reset:
+ reset_usb.reset_android_usb(serial)
+ else:
+ logging.warning('USB reset disabled for %s (crbug.com/642914)',
+ serial)
except IOError:
logging.exception('Unable to reset USB for %s.', serial)
if blacklist:
@@ -167,6 +170,8 @@ def main():
parser.add_argument('--known-devices-file', action='append', default=[],
dest='known_devices_files',
help='Path to known device lists.')
+ parser.add_argument('--enable-usb-reset', action='store_true',
+ help='Reset USB if necessary.')
parser.add_argument('-v', '--verbose', action='count', default=1,
help='Log more information.')
@@ -189,7 +194,7 @@ def main():
devices = [device_utils.DeviceUtils(s)
for s in expected_devices.union(usb_devices)]
- RecoverDevices(devices, blacklist)
+ RecoverDevices(devices, blacklist, enable_usb_reset=args.enable_usb_reset)
if __name__ == '__main__':
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698