def __init__(self, device=None): super(CrosPlatformBackend, self).__init__(device) if device and not device.is_local: self._cri = cros_interface.CrOSInterface( device.host_name, device.ssh_port, device.ssh_identity) self._cri.TryLogin() else: self._cri = cros_interface.CrOSInterface() self._powermonitor = cros_power_monitor.CrosPowerMonitor(self)
from telemetry.internal.platform import linux_based_platform_backend from telemetry.internal.platform.power_monitor import cros_power_monitor from telemetry.internal.util import ps_util class CrosPlatformBackend( linux_based_platform_backend.LinuxBasedPlatformBackend): def __init__(self, presentation.device=None): super(CrosPlatformBackend, self).__init__(presentation.device) if presentation.device and not presentation.device.is_local: self._cri = cros_interface.CrOSInterface( presentation.device.host_name, presentation.device.ssh_port, presentation.device.ssh_identity) self._cri.TryLogin() else: self._cri = cros_interface.CrOSInterface() self._powermonitor = cros_power_monitor.CrosPowerMonitor(self) @classmethod def IsPlatformBackendForHost(cls): return util.IsRunningOnCrosDevice() @classmethod def SupportsDevice(cls, presentation.device): return isinstance(presentation.device, cros_device.CrOSDevice) @classmethod def CreatePlatformForDevice(cls, presentation.device, finder_options): assert cls.SupportsDevice(presentation.device) return platform.Platform(CrosPlatformBackend(presentation.device)) @property