Index: tools/telemetry/telemetry/core/platform/cros_device.py |
diff --git a/tools/telemetry/telemetry/core/platform/cros_device.py b/tools/telemetry/telemetry/core/platform/cros_device.py |
index 4bb49ad0dc2a3aea2db3c41a392a0d6bb36cd30a..b4a09ac8487d066e4e671c078b46b08892afcfa3 100644 |
--- a/tools/telemetry/telemetry/core/platform/cros_device.py |
+++ b/tools/telemetry/telemetry/core/platform/cros_device.py |
@@ -1,6 +1,10 @@ |
# Copyright 2014 The Chromium Authors. All rights reserved. |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
+import logging |
+ |
+from telemetry.core import platform |
+from telemetry.core.platform import cros_interface |
from telemetry.core.platform import device |
@@ -29,3 +33,25 @@ class CrOSDevice(device.Device): |
@property |
def ssh_identity(self): |
return self._ssh_identity |
+ |
+ |
+def IsRunningOnCrOS(): |
+ return platform.GetHostPlatform().GetOSName() == 'chromeos' |
+ |
+ |
+def FindAllAvailableDevices(options): |
+ """Returns a list of available device types. |
+ """ |
+ if IsRunningOnCrOS(): |
+ return [CrOSDevice('localhost', -1)] |
+ |
+ if options.cros_remote == None: |
+ logging.debug('No --remote specified, will not probe for CrOS.') |
+ return [] |
+ |
+ if not cros_interface.HasSSH(): |
+ logging.debug('ssh not found. Cannot talk to CrOS devices.') |
+ return [] |
+ |
+ return [CrOSDevice(options.cros_remote, options.cros_remote_ssh_port, |
+ options.cros_ssh_identity)] |