134 lines
2.8 KiB
Markdown

# Chromebook Volume Buttons Driver
Hardware volume button driver for Chromebook devices with non-functional side-mounted volume controls.
## Free and Open Source Software
This project is **completely free and open source**.
## My Hardware
**Primary Target:**
- Lenovo IdeaPad Flex 5i Chromebook Gen 8
- Codename: Taeko (Google Brya family)
- Processor: Intel Core i3-1215U
- BIOS: MrChromebox custom firmware
- OS: Nyarch Linux
**GPIO Configuration:**
- Volume Down: GPIO 3 (EC:EC_VOLDN_BTN_ODL)
- Volume Up: GPIO 4 (EC:EC_VOLUP_BTN_ODL)
- Chip: /dev/gpiochip1 (cros-ec-gpio)
## Features
- Real-time volume button detection via GPIO polling
- Automatic key repeat after 0.8 second hold
- Repeat interval: 100ms
- Systemd service for automatic startup
- Low CPU overhead (80ms polling interval)
## Prerequisites
**Required packages:**
```bash
sudo pacman -S python-evdev libgpiod
```
**Python dependencies:**
- python-gpiod (>= 2.2.0)
- python-evdev (>= 1.9.0)
## Installation
### Quick Installation
```bash
git clone https://gitea.legion-muyue.fr/Muyue/chromebook-volume-buttons.git
cd chromebook-volume-buttons
sudo bash install.sh
```
### Manual Installation
1. Copy the script to system location:
```bash
sudo cp volume_buttons.py /usr/local/bin/chromebook-volume-buttons
sudo chmod +x /usr/local/bin/chromebook-volume-buttons
```
2. Install systemd service:
```bash
sudo cp chromebook-volume-buttons.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable chromebook-volume-buttons.service
sudo systemctl start chromebook-volume-buttons.service
```
## Usage
The service starts automatically on boot. Manual control:
```bash
# Check status
sudo systemctl status chromebook-volume-buttons.service
# View live logs
sudo journalctl -u chromebook-volume-buttons.service -f
# Restart service
sudo systemctl restart chromebook-volume-buttons.service
# Stop service
sudo systemctl stop chromebook-volume-buttons.service
# Disable auto-start
sudo systemctl disable chromebook-volume-buttons.service
```
## Development
### Testing Without Service
Run the script directly for debugging:
```bash
sudo python3 volume_buttons.py
```
Press Ctrl+C to stop.
### Modifying Timing
Edit the following constants in `volume_buttons.py`:
```python
self.HOLD_DELAY = 1.0 # Seconds before repeat
self.REPEAT_INTERVAL = 0.2 # Seconds between repeats
POLL_INTERVAL = 0.05 # GPIO polling interval
```
## Hardware Variations
If your Chromebook model differs, check GPIO mappings:
```bash
sudo gpioinfo
```
Look for volume button GPIO lines and update constants in the script:
```python
VOLUME_DOWN_PIN = 3 # Update if different
VOLUME_UP_PIN = 4 # Update if different
```
## References
- ChromiumOS EC GPIO Documentation
- Linux GPIO Userspace API (libgpiod)
- Python evdev Documentation
- MrChromebox Firmware
## Author
Muyue