Re-add TUF keyboard support

This commit is contained in:
Luke D. Jones
2024-04-17 21:39:58 +12:00
parent df88ff1acb
commit f9dca2da5d
2 changed files with 23 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ use rog_platform::keyboard_led::KeyboardLed;
use zbus::zvariant::OwnedObjectPath;
use super::config::AuraConfig;
use crate::ctrl_aura::manager::dbus_path_for_dev;
use crate::ctrl_aura::manager::{dbus_path_for_dev, dbus_path_for_tuf};
use crate::error::RogError;
#[derive(Debug)]
@@ -119,6 +119,23 @@ impl CtrlKbdLed {
devices.push(dev);
}
}
// Check for a TUF laptop LED. Assume there is only ever one.
if let Ok(tuf_kbd) = KeyboardLed::new() {
if tuf_kbd.has_kbd_rgb_mode() {
info!("AuraControl found a TUF laptop keyboard");
let ctrl = CtrlKbdLed {
led_type: AuraDeviceType::LaptopTuf,
led_node: LEDNode::KbdLed(tuf_kbd),
supported_data: LedSupportData::get_data("tuf"),
per_key_mode_active: false,
config: Self::init_config("tuf"),
dbus_path: dbus_path_for_tuf(),
};
devices.push(ctrl);
}
}
info!("Found {} Aura devices", devices.len());
Ok(devices)

View File

@@ -46,6 +46,7 @@ impl AuraManager {
};
// detect all plugged in aura devices (eventually)
// only USB devices are detected for here
spawn_blocking(move || {
let mut monitor = MonitorBuilder::new()?.match_subsystem("hidraw")?.listen()?;
let mut poll = Poll::new()?;
@@ -164,6 +165,10 @@ pub(crate) fn dbus_path_for_dev(parent: &Device) -> Option<OwnedObjectPath> {
None
}
pub(crate) fn dbus_path_for_tuf() -> OwnedObjectPath {
ObjectPath::from_str_unchecked(&format!("{AURA_ZBUS_PATH}/tuf")).into()
}
async fn start_tasks(
mut zbus: CtrlAuraZbus,
connection: Connection,