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 std::sync::Arc;
use dmi_id::DMIID;
use futures_lite::future::block_on; use futures_lite::future::block_on;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use mio::{Events, Interest, Poll, Token}; use mio::{Events, Interest, Poll, Token};
@@ -163,7 +164,7 @@ impl DeviceManager {
} }
// AURA LAPTOP DEVICE // AURA LAPTOP DEVICE
if let Ok(dev_type) = DeviceHandle::maybe_laptop_aura( if let Ok(dev_type) = DeviceHandle::maybe_laptop_aura(
dev, Some(dev),
usb_id.to_str().unwrap_or_default(), usb_id.to_str().unwrap_or_default(),
) )
.await .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 { if let Ok(devs) = &mut Self::init_all_scsi(connection).await {
devices.append(devs); devices.append(devs);
} }

View File

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

View File

@@ -2,7 +2,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-12-22 03:56+0000\n" "POT-Creation-Date: 2024-12-23 23:59+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"