Implement Acer RGB control daemon and CLI

- Removed acer-rgb.cpp and replaced it with acer-rgb-cli.cpp for command-line interface functionality.
- Added acer-rgbd.cpp to implement a daemon that manages RGB settings for keyboard, lid, and button devices.
- Introduced a socket communication mechanism via acer-rgb.sh for sending commands to the daemon.
- Created service and socket files (acer-rgbd.service and acer-rgbd.socket) for systemd integration, allowing the daemon to run as a service.
- Implemented state persistence for RGB settings in /var/lib/acer-rgbd/state.txt, enabling restoration on boot.
This commit is contained in:
Fernando Crespo
2026-01-30 16:43:45 -03:00
parent 8918d48b12
commit 4c1c7a5477
7 changed files with 583 additions and 27 deletions

View File

@@ -1,34 +1,64 @@
all:
all: build
rgb:
clang++ -std=c++23 ./rgb.cpp -o ./rgb
# rgb:
# clang++ -std=c++23 ./rgb.cpp -o ./rgb
acer-rgb:
clang++ -std=c++23 ./acer-rgb.cpp -o ./acer-rgb
acer-rgb-cli:
clang++ -std=c++23 acer-rgb-cli.cpp -o acer-rgb-cli
build-cli: acer-rgb-cli
clean-cli:
rm -f acer-rgb-cli
acer-rgbd:
g++ -O2 -std=c++23 acer-rgbd.cpp -o acer-rgbd
build: acer-rgbd
clean:
rm -f acer-rgbd
install: acer-rgbd acer-rgb
sudo install -Dm755 acer-rgbd /usr/local/bin/acer-rgbd
sudo install -Dm755 acer-rgb.sh /usr/local/bin/acer-rgb
sudo install -Dm644 acer-rgbd.service /etc/systemd/system/acer-rgbd.service
sudo install -Dm644 acer-rgbd.socket /etc/systemd/system/acer-rgbd.socket
sudo systemctl daemon-reload
sudo systemctl enable --now acer-rgbd.service
uninstall:
sudo systemctl disable --now acer-rgbd.service
sudo rm -f /usr/local/bin/acer-rgbd
sudo rm -f /usr/local/bin/acer-rgb
sudo rm -f /etc/systemd/system/acer-rgbd.service
sudo rm -f /etc/systemd/system/acer-rgbd.socket
sudo systemctl daemon-reload
all-red: acer-rgb
sudo ./acer-rgb /dev/hidraw2 keyboard static --brightness 100 --rgb 255 0 0 --zone all
sudo ./acer-rgb /dev/hidraw2 lid static --brightness 100 --rgb 255 0 0 --zone all
sudo ./acer-rgb /dev/hidraw2 button static --brightness 100 --rgb 255 0 0 --zone all
all-red: acer-rgb-cli
sudo ./acer-rgb-cli /dev/hidraw2 keyboard static --brightness 100 --rgb 255 0 0 --zone all
sudo ./acer-rgb-cli /dev/hidraw2 lid static --brightness 100 --rgb 255 0 0 --zone all
sudo ./acer-rgb-cli /dev/hidraw2 button static --brightness 100 --rgb 255 0 0 --zone all
all-green: acer-rgb
sudo ./acer-rgb /dev/hidraw2 keyboard static --brightness 100 --rgb 0 255 0 --zone all
sudo ./acer-rgb /dev/hidraw2 lid static --brightness 100 --rgb 0 255 0 --zone all
sudo ./acer-rgb /dev/hidraw2 button static --brightness 100 --rgb 0 255 0 --zone all
all-green: acer-rgb-cli
sudo ./acer-rgb-cli /dev/hidraw2 keyboard static --brightness 100 --rgb 0 255 0 --zone all
sudo ./acer-rgb-cli /dev/hidraw2 lid static --brightness 100 --rgb 0 255 0 --zone all
sudo ./acer-rgb-cli /dev/hidraw2 button static --brightness 100 --rgb 0 255 0 --zone all
all-blue: acer-rgb
sudo ./acer-rgb /dev/hidraw2 keyboard static --brightness 100 --rgb 0 0 255 --zone all
sudo ./acer-rgb /dev/hidraw2 lid static --brightness 100 --rgb 0 0 255 --zone all
sudo ./acer-rgb /dev/hidraw2 button static --brightness 100 --rgb 0 0 255 --zone all
all-blue: acer-rgb-cli
sudo ./acer-rgb-cli /dev/hidraw2 keyboard static --brightness 100 --rgb 0 0 255 --zone all
sudo ./acer-rgb-cli /dev/hidraw2 lid static --brightness 100 --rgb 0 0 255 --zone all
sudo ./acer-rgb-cli /dev/hidraw2 button static --brightness 100 --rgb 0 0 255 --zone all
all-magenta: acer-rgb
sudo ./acer-rgb /dev/hidraw2 keyboard static --brightness 100 --rgb 255 0 255 --zone all
sudo ./acer-rgb /dev/hidraw2 lid static --brightness 100 --rgb 255 0 255 --zone all
sudo ./acer-rgb /dev/hidraw2 button static --brightness 100 --rgb 255 0 255 --zone all
all-magenta: acer-rgb-cli
sudo ./acer-rgb-cli /dev/hidraw2 keyboard static --brightness 100 --rgb 255 0 255 --zone all
sudo ./acer-rgb-cli /dev/hidraw2 lid static --brightness 100 --rgb 255 0 255 --zone all
sudo ./acer-rgb-cli /dev/hidraw2 button static --brightness 100 --rgb 255 0 255 --zone all
all-cyan: acer-rgb
sudo ./acer-rgb /dev/hidraw2 keyboard static --brightness 100 --rgb 0 255 255 --zone all
sudo ./acer-rgb /dev/hidraw2 lid static --brightness 100 --rgb 0 255 255 --zone all
sudo ./acer-rgb /dev/hidraw2 button static --brightness 100 --rgb 0 255 255 --zone all
all-cyan: acer-rgb-cli
sudo ./acer-rgb-cli /dev/hidraw2 keyboard static --brightness 100 --rgb 0 255 255 --zone all
sudo ./acer-rgb-cli /dev/hidraw2 lid static --brightness 100 --rgb 0 255 255 --zone all
sudo ./acer-rgb-cli /dev/hidraw2 button static --brightness 100 --rgb 0 255 255 --zone all