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

Unified Diff: common/battor/battor/battor_wrapper.py

Issue 1920023002: [BattOr] Add real device smoke test (Closed) Base URL: git@github.com:catapult-project/catapult@master
Patch Set: Created 4 years, 8 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
Index: common/battor/battor/battor_wrapper.py
diff --git a/common/battor/battor/battor_wrapper.py b/common/battor/battor/battor_wrapper.py
index e2966eb3c54e52e0232890b8d93dc03255580f7a..562f1e6f2ff74161d1d2d770514569fca2ca0d81 100644
--- a/common/battor/battor/battor_wrapper.py
+++ b/common/battor/battor/battor_wrapper.py
@@ -14,6 +14,18 @@ import dependency_manager
from devil.utils import battor_device_mapping
from devil.utils import find_usb_devices
+sys.path.insert(
+ 1, os.path.join(os.path.dirname(__file__), '..', '..', '..', 'telemetry',
+ 'third_party', 'pyserial'))
+try:
+ import serial
+ from serial.tools import list_ports
+except:
nednguyen 2016/04/26 04:02:53 We can remove this now :-)
rnephew (Reviews Here) 2016/04/26 15:15:44 Done.
+ print
+ print '-----------------------'
+ print serial.__file__
+ print '======================='
+ raise
class BattorWrapper(object):
"""A class for communicating with a BattOr in python."""
@@ -128,9 +140,11 @@ class BattorWrapper(object):
raise battor_error.BattorError(
'%s is an unsupported platform.' % target_platform)
if target_platform in ['win']:
- # TODO: We need a way to automatically detect correct port.
- # crbug.com/60397
- return 'COM3'
+ for (port, desc, _) in serial.tools.list_ports.comports():
charliea (OOO until 10-5) 2016/04/26 13:30:38 Later on, we should probably add a flag to the Bat
nednguyen 2016/04/26 15:10:57 There should be way for us to grab the "Battor 3.2
rnephew (Reviews Here) 2016/04/26 15:15:44 Acknowledged.
+ if 'USB Serial Port' in desc:
+ return port
+ raise battor_error.BattorError(
+ 'Could not find BattOr attached to machine.')
device_tree = find_usb_devices.GetBusNumberToDeviceTreeMap(fast=True)
if battor_path:
if not isinstance(battor_path, basestring):

Powered by Google App Engine
This is Rietveld 408576698