Minor prep

This commit is contained in:
Luke D. Jones
2024-12-18 11:21:40 +13:00
parent c05c8ba648
commit 0ddfe76c31
11 changed files with 79 additions and 308 deletions

View File

@@ -13,9 +13,6 @@ edition.workspace = true
name = "asusd"
path = "src/daemon.rs"
[features]
tokio_debug = []
[dependencies]
config-traits = { path = "../config-traits" }
rog_anime = { path = "../rog-anime", features = ["dbus"] }
@@ -30,7 +27,7 @@ inotify.workspace = true
mio.workspace = true
tokio.workspace = true
console-subscriber = "0.2.0"
# console-subscriber = "0.2.0"
# cli and logging
log.workspace = true

View File

@@ -219,7 +219,7 @@ impl CtrlKbdLed {
if dmi.product_family.contains("TUF") {
info!("AuraControl found a TUF laptop keyboard");
let ctrl = CtrlKbdLed {
led_type: AuraDeviceType::LaptopTuf,
led_type: AuraDeviceType::LaptopKeyboardTuf,
led_node: LEDNode::KbdLed(kbd_backlight),
supported_data: LedSupportData::get_data("tuf"),
per_key_mode_active: false,
@@ -442,7 +442,7 @@ mod tests {
power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow],
};
let mut controller = CtrlKbdLed {
led_type: AuraDeviceType::LaptopPost2021,
led_type: AuraDeviceType::LaptopKeyboard2021,
led_node: LEDNode::Rog(
Some(KeyboardBacklight::default()),
HidRaw::new("19b6").unwrap(),
@@ -492,7 +492,7 @@ mod tests {
power_zones: vec![PowerZones::Keyboard, PowerZones::RearGlow],
};
let mut controller = CtrlKbdLed {
led_type: AuraDeviceType::LaptopPost2021,
led_type: AuraDeviceType::LaptopKeyboard2021,
led_node: LEDNode::Rog(
Some(KeyboardBacklight::default()),
HidRaw::new("19b6").unwrap(),

View File

@@ -49,8 +49,10 @@ impl CtrlSlash {
let usb = USBRaw::new(rog_slash::usb::PROD_ID).ok();
let hid = HidRaw::new(rog_slash::usb::PROD_ID_STR).ok();
let node = if usb.is_some() {
info!("Slash is using raw USB");
unsafe { Node::Usb(usb.unwrap_unchecked()) }
} else if hid.is_some() {
info!("Slash is using HIDRAW");
unsafe { Node::Hid(hid.unwrap_unchecked()) }
} else {
return Err(RogError::Slash(SlashError::NoDevice));

View File

@@ -19,7 +19,7 @@ use zbus::fdo::ObjectManager;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
console_subscriber::init();
// console_subscriber::init();
let mut logger = env_logger::Builder::new();
logger
.parse_default_env()
@@ -108,6 +108,8 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
}
}
let _ = AuraManager::new(connection.clone()).await?;
match CtrlSlash::new() {
Ok(ctrl) => {
let zbus = CtrlSlashZbus(Arc::new(Mutex::new(ctrl)));
@@ -123,8 +125,6 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
}
}
let _ = AuraManager::new(connection.clone()).await?;
// Request dbus name after finishing initalizing all functions
connection.request_name(DBUS_NAME).await?;