|
1 | | -# libectool |
| 1 | +# Pyectool |
2 | 2 |
|
3 | | -libectool is a shared library extracted from ectool, providing programmatic access to Embedded Controller (EC) functionalities on ChromeOS and compatible devices. |
| 3 | +**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`](https://gitlab.howett.net/DHowett/ectool) utility, and exposes EC control functions directly to Python programs via a native extension. |
4 | 4 |
|
5 | | -## Features |
6 | | -- Exposes EC control functions via a shared library (`libectool.so`). |
7 | | -- Supports fan control, battery management, temperature monitoring, and more. |
8 | | -- Designed for integration into other applications. |
| 5 | +## Features |
| 6 | + |
| 7 | +- Python bindings for EC functionality using `pybind11`. |
| 8 | +- Supports fan duty control, temperature reading, AC power status, and more. |
| 9 | +- Designed for integration with hardware management or fan control tools. |
| 10 | +- Shared core logic with `libectool` for C/C++ integration. |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## 🛠️ Build & Install (Python Package) |
| 15 | + |
| 16 | +We use [`scikit-build-core`](https://scikit-build-core.readthedocs.io/en/latest/) to build the C++ extension via CMake. |
| 17 | + |
| 18 | +### Prerequisites |
| 19 | + |
| 20 | +Install the required system dependencies: |
9 | 21 |
|
10 | | -## Build Instructions |
11 | 22 | ```sh |
12 | | -cd libectool |
13 | | -mkdir build && cd build |
14 | | -cmake .. |
15 | | -cmake --build . |
16 | | -``` |
17 | | -## Post Build Instructions |
18 | | -After building, you need to move `libectool.so` to a library directory where it can be found by your system: |
| 23 | +sudo apt update |
| 24 | +sudo apt install -y libusb-1.0-0-dev libftdi1-dev pkg-config |
| 25 | +```` |
| 26 | +### Clone the repository and switch to the Python package branch |
19 | 27 |
|
20 | | -### Option 1 — User-specific (Recommended for non-root users) |
21 | 28 | ```sh |
22 | | -mkdir -p ~/.local/lib |
23 | | -cp src/core/libectool.so ~/.local/lib/libectool.so |
24 | | -export LD_LIBRARY_PATH="$HOME/.local/lib:$LD_LIBRARY_PATH" |
| 29 | +git clone --branch dev_py_pkg_build https://github.com/AhmedYasserrr/libectool.git |
| 30 | +cd libectool |
25 | 31 | ``` |
26 | | -To make it persistent across sessions, add the export to your shell configuration: |
| 32 | +### Install the package |
27 | 33 | ```sh |
28 | | -echo 'export LD_LIBRARY_PATH="$HOME/.local/lib:$LD_LIBRARY_PATH"' >> ~/.bashrc |
| 34 | +python -m pip install --upgrade pip |
| 35 | +pip install build scikit-build-core pybind11 |
| 36 | +pip install . |
29 | 37 | ``` |
30 | | -### Option 2 — Global installation |
| 38 | + |
| 39 | +After installing, **do not run Python from the `libectool/` directory**, since it contains a `pyectool/` folder that may shadow the installed package. |
| 40 | + |
| 41 | +Instead, test from another location, e.g.: |
| 42 | + |
31 | 43 | ```sh |
32 | | -sudo cp src/core/libectool.so /usr/local/lib/libectool.so |
| 44 | +cd .. |
| 45 | +python -c "import pyectool; print(pyectool.__version__)" |
33 | 46 | ``` |
0 commit comments