- 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.
19 lines
400 B
Bash
Executable File
19 lines
400 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SOCK="/run/acer-rgbd.sock"
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
echo "Usage:"
|
|
echo " acer-rgb GET"
|
|
echo " acer-rgb SET hidraw=/dev/hidraw2 dev=keyboard effect=static bright=80 r=255 g=0 b=0 zone=all"
|
|
exit 2
|
|
fi
|
|
|
|
cmd="$*"
|
|
if command -v socat >/dev/null 2>&1; then
|
|
printf "%s\n" "$cmd" | socat - UNIX-CONNECT:"$SOCK"
|
|
else
|
|
printf "%s\n" "$cmd" | nc -U "$SOCK"
|
|
fi
|