Skip to content

Commit 16bbf20

Browse files
Update README.md
1 parent 043647c commit 16bbf20

File tree

1 file changed

+41
-33
lines changed

1 file changed

+41
-33
lines changed

README.md

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
# Pyectool
22

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.
3+
**Pyectool** provides Python bindings for interacting with the Embedded Controller (EC) on ChromeOS and Framework devices.
4+
It is extracted from and based on [Dustin Howett's `ectool`](https://gitlab.howett.net/DHowett/ectool) and exposes EC control functions directly to Python via a native C++ extension built with `pybind11`.
45

5-
## Features
6+
Pyectool also provides a simple way to build the original `ectool` CLI tool, or to build `libectool`—a standalone C library that wrap most of ectool’s functionality, making it reusable in C/C++ projects or accessible from other languages. Both the CLI binary and the library are built automatically during installation.
67

7-
- Python bindings for EC functionality using `pybind11`.
8+
## Features
9+
- Python-native interface to low-level EC functionality via `pybind11`
810
- 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+
- Designed for hardware monitoring, thermal management, and fan control tooling.
12+
- Bundles the native `ectool` CLI and `libectool` C library alongside the Python package:
13+
* `pyectool/bin/ectool` (ectool CLI)
14+
* `pyectool/lib/libectool.a` (libectool static library)
15+
* `pyectool/include/libectool.h` (libectool C header)
1116

1217
---
1318

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.
19+
## Installation
1720

1821
### Prerequisites
1922

20-
Install the required system dependencies:
23+
Install system dependencies:
2124

2225
```sh
2326
sudo apt update
2427
sudo apt install -y libusb-1.0-0-dev libftdi1-dev pkg-config
2528
````
2629
### Clone the repository
2730

28-
## Install system-wide
31+
### Install the package
32+
33+
#### Option 1: System-wide (not recommended unless you know what you're doing)
2934
```sh
3035
sudo pip install .
3136
```
@@ -36,49 +41,45 @@ sudo env "PIP_BREAK_SYSTEM_PACKAGES=1" pip install .
3641
```
3742
(Required on modern distros like Ubuntu 24.04 due to PEP 668.)
3843

39-
### Test from outside the repo dir
40-
After installing, **do not run Python from the `libectool/` directory**, since it contains a `pyectool/` folder that may shadow the installed package.
41-
42-
Instead, test from another location, e.g.:
43-
44-
```sh
45-
cd ..
46-
sudo python -c "from pyectool import ECController; ec = ECController(); print(ec.is_on_ac())"
47-
```
48-
49-
## VENV INSTALLATION
50-
51-
If you **don’t** want to touch system Python:
52-
53-
### Create venv
54-
44+
#### Option 2: Isolated virtual environment (recommended)
5545
```bash
5646
python3 -m venv ~/.venv/pyectool
5747
source ~/.venv/pyectool/bin/activate
48+
pip install .
5849
```
5950

60-
### Install your package
51+
### ⚠️ Important Note
52+
53+
After installation, **do not run Python from inside the `libectool/` directory**. It contains a `pyectool/` folder that may shadow the installed package.
54+
55+
Instead, test from a different directory:
6156

62-
Inside the venv:
6357
```bash
64-
pip install .
58+
cd ..
59+
python -c "from pyectool import ECController; ec = ECController(); print(ec.is_on_ac())"
6560
```
66-
### Test from outside the repo dir
61+
62+
If you're using a virtual environment and want to preserve its `PATH`, use:
6763
```bash
6864
cd ..
6965
sudo env "PATH=$PATH" python -c "from pyectool import ECController; ec = ECController(); print(ec.is_on_ac())"
7066
```
67+
This ensures the correct Python from your virtual environment is used even with `sudo`.
68+
69+
---
7170
72-
### Available Functions
71+
## Usage
7372
74-
All functions are methods of the `ECController` class. Instantiate it like so:
73+
### Create an EC controller instance
7574
7675
```python
7776
from pyectool import ECController
77+
7878
ec = ECController()
7979
```
8080
81-
Then use the methods as shown below:
81+
### Available Methods
82+
8283
8384
| Method | Description |
8485
| ------------------------------------------------------- | ------------------------------------------------------------------------- |
@@ -110,3 +111,10 @@ Returned by `get_temp_info()`, acts like a `dict` with:
110111
* `temp`: int
111112
* `temp_fan_off`: int
112113
* `temp_fan_max`: int
114+
115+
---
116+
117+
## License
118+
119+
BSD 3-Clause License
120+
See the `LICENSE` file for full terms.

0 commit comments

Comments
 (0)