Pyectool is a Python package with C++ bindings for interacting with the Embedded Controller (EC) on ChromeOS and Framework devices. It is extracted from and based on ectool
utility, and exposes EC control functions directly to Python programs via a native extension.
- Python bindings for EC functionality using
pybind11
. - Supports fan duty control, temperature reading, AC power status, and more.
- Designed for integration with hardware management or fan control tools.
- Shared core logic with
libectool
for C/C++ integration.
We use scikit-build-core
to build the C++ extension via CMake.
Install the required system dependencies:
sudo apt update
sudo apt install -y libusb-1.0-0-dev libftdi1-dev pkg-config
sudo pip install .
Or:
sudo env "PIP_BREAK_SYSTEM_PACKAGES=1" pip install .
(Required on modern distros like Ubuntu 24.04 due to PEP 668.)
After installing, do not run Python from the libectool/
directory, since it contains a pyectool/
folder that may shadow the installed package.
Instead, test from another location, e.g.:
cd ..
sudo python -c "import pyectool; print(pyectool.is_on_ac())"
If you don’t want to touch system Python:
python3 -m venv ~/.venv/pyectool
source ~/.venv/pyectool/bin/activate
Inside the venv:
pip install .
cd ..
sudo env "PATH=$PATH" python -c "import pyectool; print(pyectool.is_on_ac())"
Function | Description |
---|---|
auto_fan_control() |
Enables automatic fan control by the EC. |
get_max_non_battery_temperature() -> float |
Returns the highest temperature (in °C) from all sensors except the battery. |
get_max_temperature() -> float |
Returns the highest temperature (in °C) from all EC sensors including battery. |
is_on_ac() -> bool |
Checks whether the device is running on AC power. |
set_fan_duty(percent: int) |
Sets the fan duty cycle manually (0–100%). |