diff --git a/devlib/module/cpufreq.py b/devlib/module/cpufreq.py index 2c7dc36..a41cff2 100644 --- a/devlib/module/cpufreq.py +++ b/devlib/module/cpufreq.py @@ -29,7 +29,20 @@ class CpufreqModule(Module): @staticmethod def probe(target): + + # x86 with Intel P-State driver + if target.abi == 'x86_64': + path = '/sys/devices/system/cpu/intel_pstate' + if target.file_exists(path): + return True + + # Generic CPUFreq support (single policy) path = '/sys/devices/system/cpu/cpufreq' + if target.file_exists(path): + return True + + # Generic CPUFreq support (per CPU policy) + path = '/sys/devices/system/cpu/cpu0/cpufreq' return target.file_exists(path) def __init__(self, target): diff --git a/devlib/module/hotplug.py b/devlib/module/hotplug.py index d89ce07..8ae238e 100644 --- a/devlib/module/hotplug.py +++ b/devlib/module/hotplug.py @@ -8,7 +8,10 @@ class HotplugModule(Module): @classmethod def probe(cls, target): # pylint: disable=arguments-differ - path = cls._cpu_path(target, 0) + # If a system has just 1 CPU, it makes not sense to hotplug it. + # If a system has more than 1 CPU, CPU0 could be configured to be not + # hotpluggable. Thus, check for hotplug support by looking at CPU1 + path = cls._cpu_path(target, 1) return target.file_exists(path) and target.is_rooted @classmethod @@ -30,6 +33,8 @@ class HotplugModule(Module): def hotplug(self, cpu, online): path = self._cpu_path(self.target, cpu) + if not self.target.file_exists(path): + return value = 1 if online else 0 self.target.write_value(path, value) diff --git a/devlib/target.py b/devlib/target.py index 9eabb7f..7559b6c 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -177,8 +177,8 @@ class Target(object): tid = id(threading.current_thread()) self._connections[tid] = self.get_connection(timeout=timeout) self.busybox = self.get_installed('busybox') - self._update_modules('connected') self.platform.update_from_target(self) + self._update_modules('connected') if self.platform.big_core and self.load_default_modules: self._install_module(get_module('bl')) diff --git a/devlib/utils/serial_port.py b/devlib/utils/serial_port.py index 62df065..d1410a4 100644 --- a/devlib/utils/serial_port.py +++ b/devlib/utils/serial_port.py @@ -19,7 +19,13 @@ from contextlib import contextmanager from logging import Logger import serial -import fdpexpect + +import pexpect +from distutils.version import StrictVersion as V +if V(pexpect.__version__) < V('4.0.0'): + import fdpexpect +else: + from pexpect import fdpexpect # Adding pexpect exceptions into this module's namespace from pexpect import EOF, TIMEOUT # NOQA pylint: disable=W0611 diff --git a/devlib/utils/ssh.py b/devlib/utils/ssh.py index 66e9770..5d2896b 100644 --- a/devlib/utils/ssh.py +++ b/devlib/utils/ssh.py @@ -23,7 +23,12 @@ import threading import tempfile import shutil -import pxssh +import pexpect +from distutils.version import StrictVersion as V +if V(pexpect.__version__) < V('4.0.0'): + import pxssh +else: + from pexpect import pxssh from pexpect import EOF, TIMEOUT, spawn from devlib.exception import HostError, TargetError, TimeoutError