Re-add TUF LED support

This commit is contained in:
Luke D. Jones
2024-12-24 14:08:06 +13:00
parent ab7a4bbad3
commit 6292b3361d
3 changed files with 22 additions and 4 deletions

View File

@@ -6,6 +6,7 @@
use std::sync::Arc;
use dmi_id::DMIID;
use futures_lite::future::block_on;
use log::{debug, error, info, warn};
use mio::{Events, Interest, Poll, Token};
@@ -163,7 +164,7 @@ impl DeviceManager {
}
// AURA LAPTOP DEVICE
if let Ok(dev_type) = DeviceHandle::maybe_laptop_aura(
dev,
Some(dev),
usb_id.to_str().unwrap_or_default(),
)
.await
@@ -332,6 +333,23 @@ impl DeviceManager {
}
}
let board_name = DMIID::new().unwrap_or_default().board_name;
if board_name.contains("TUF") {
// TUF AURA LAPTOP DEVICE
info!("Seems to be a TUF laptop, try using sysfs backlight control");
if let Ok(dev_type) = DeviceHandle::maybe_laptop_aura(None, "tuf").await {
if let DeviceHandle::Aura(aura) = dev_type.clone() {
let path = dbus_path_for_tuf();
let ctrl = AuraZbus::new(aura);
ctrl.start_tasks(connection, path.clone()).await.unwrap();
devices.push(AsusDevice {
device: dev_type,
dbus_path: path,
});
}
}
}
if let Ok(devs) = &mut Self::init_all_scsi(connection).await {
devices.append(devs);
}

View File

@@ -168,7 +168,7 @@ impl DeviceHandle {
}
pub async fn maybe_laptop_aura(
device: Arc<Mutex<HidRaw>>,
device: Option<Arc<Mutex<HidRaw>>>,
prod_id: &str,
) -> Result<Self, RogError> {
debug!("Testing for laptop aura");
@@ -194,7 +194,7 @@ impl DeviceHandle {
let mut config = AuraConfig::load_and_update_config(prod_id);
config.led_type = aura_type;
let aura = Aura {
hid: Some(device),
hid: device,
backlight,
config: Arc::new(Mutex::new(config)),
};