feat: initial qmk-host Raw HID bridge implementation
Add a Rust daemon that connects to QMK keyboards over their Raw HID interface (VID 0x3434, usage page 0xFF60 / usage 0x0061) and provides: - Bi-directional layer sync: CMD_LAYER_SYNC (0x40) packets are bridged between all connected keyboards so their active layers stay in sync. On connect, a FLAG_QUERY packet requests the current state from each keyboard. A second keyboard (numpad) is stubbed and ready to enable. - Volume monitoring: polls `pactl get-sink-volume @DEFAULT_SINK@` every 2 s and pushes CMD_VOLUME (0x41) packets on change. Compatible with both PulseAudio and PipeWire on KDE6/Wayland. - Brightness monitoring: polls /sys/class/backlight on the same interval and pushes CMD_BRIGHTNESS (0x42) packets on change. - Active-app stub: CMD_ACTIVE_APP (0x43) is reserved with detailed notes on KDE6/Wayland implementation approaches (KWin D-Bus, foreign toplevel protocol) for a future commit. Each keyboard runs a single combined read/write IO thread using a 10 ms read timeout to interleave HID reads and queued writes without needing two file handles. Protocol constants in src/protocol.rs mirror hid_protocol.h in the QMK firmware exactly. Licensed under GPL-3.0-or-later.
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
[package]
|
||||
name = "qmk-host"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
description = "Host bridge for bi-directional Raw HID layer sync and host data delivery to QMK keyboards"
|
||||
license = "GPL-3.0-or-later"
|
||||
|
||||
[[bin]]
|
||||
name = "qmk-host"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
hidapi = "2" # Cross-platform Raw HID access
|
||||
anyhow = "1" # Ergonomic error handling
|
||||
log = "0.4" # Logging facade
|
||||
env_logger = "0.11" # Logger implementation (RUST_LOG env var)
|
||||
ctrlc = "3" # Ctrl+C / SIGINT handler
|
||||
Reference in New Issue
Block a user