Skip to main content

hid_rgb_ctl/
lib.rs

1//! Control RGB lighting on HID LampArray and LED Page devices on Linux.
2//!
3//! This crate provides:
4//! - Auto-discovery of HID RGB devices by parsing report descriptors from sysfs
5//! - Support for HID LampArray (Usage Page 0x59) and LED Page RGB (Usage Page 0x08)
6//! - No hardcoded vendor/product IDs — works with any compliant device
7//!
8//! # Example
9//!
10//! ```no_run
11//! use hid_rgb_ctl::{discover_devices, DeviceKind, LampArrayDevice, LedRgbDevice};
12//!
13//! let devices = discover_devices();
14//! for dev in &devices {
15//!     match &dev.kind {
16//!         DeviceKind::LampArray(_) => {
17//!             let device = LampArrayDevice::new(dev);
18//!             device.set_color(255, 0, 0, 255).unwrap();
19//!         }
20//!         DeviceKind::LedRgb(_) => {
21//!             let device = LedRgbDevice::new(dev);
22//!             device.set_color(255, 0, 0, 255).unwrap();
23//!         }
24//!     }
25//! }
26//! ```
27
28#[doc(hidden)]
29pub mod cli;
30pub mod descriptor;
31pub mod device;
32pub mod error;
33
34pub use descriptor::{
35    discover_device, discover_devices, DeviceInfo, DeviceKind, LampArrayReports, LedRgbChannelInfo,
36    ReportInfo, ReportType,
37};
38pub use device::{LampArrayAttributes, LampArrayDevice, LampAttributes, LampColor, LedRgbDevice};
39pub use error::Error;