From be0550811097ec2ac7cbbce2d712513df82f3d6e Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Fri, 22 Mar 2024 17:35:59 +1300 Subject: [PATCH 01/11] Try to ensure all aura are detected at start --- asusctl/src/main.rs | 248 ++++++++++-------- asusd/src/ctrl_aura/config.rs | 2 +- asusd/src/ctrl_aura/controller.rs | 96 +++---- asusd/src/ctrl_aura/manager.rs | 65 ++--- rog-aura/data/aura_support.ron | 8 + .../translations/en/rog-control-center.po | 44 ++-- .../examples/ally-gamepad-calibration.rs | 2 +- .../examples/ally-gamepad-mode-changes.rs | 2 +- .../examples/ally-set-qam-secondary.rs | 2 +- rog-platform/src/hid_raw.rs | 27 +- 10 files changed, 259 insertions(+), 237 deletions(-) diff --git a/asusctl/src/main.rs b/asusctl/src/main.rs index 2ed66005..3d72cb51 100644 --- a/asusctl/src/main.rs +++ b/asusctl/src/main.rs @@ -103,7 +103,7 @@ fn check_service(name: &str) -> bool { false } -fn find_aura_iface() -> Result, Box> { +fn find_aura_iface() -> Result>, Box> { let conn = zbus::blocking::Connection::system().unwrap(); let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org") .unwrap(); @@ -123,11 +123,17 @@ fn find_aura_iface() -> Result, Box { - let level = aura.brightness()?; - println!("Current keyboard led brightness: {level:?}"); + for aura in aura.iter() { + match brightness.level() { + None => { + let level = aura.brightness()?; + println!("Current keyboard led brightness: {level:?}"); + } + Some(level) => aura.set_brightness(rog_aura::LedBrightness::from(level))?, } - Some(level) => aura.set_brightness(rog_aura::LedBrightness::from(level))?, } } else { println!("No aura interface found"); @@ -206,8 +219,10 @@ fn do_parsed( if parsed.next_kbd_bright { if let Ok(aura) = find_aura_iface() { - let brightness = aura.brightness()?; - aura.set_brightness(brightness.next())?; + for aura in aura.iter() { + let brightness = aura.brightness()?; + aura.set_brightness(brightness.next())?; + } } else { println!("No aura interface found"); } @@ -215,8 +230,10 @@ fn do_parsed( if parsed.prev_kbd_bright { if let Ok(aura) = find_aura_iface() { - let brightness = aura.brightness()?; - aura.set_brightness(brightness.prev())?; + for aura in aura.iter() { + let brightness = aura.brightness()?; + aura.set_brightness(brightness.prev())?; + } } else { println!("No aura interface found"); } @@ -229,10 +246,11 @@ fn do_parsed( supported_properties ); if let Ok(aura) = find_aura_iface() { - let bright = aura.supported_brightness()?; - let modes = aura.supported_basic_modes()?; - let zones = aura.supported_basic_zones()?; - let power = aura.supported_power_zones()?; + // TODO: multiple RGB check + let bright = aura.first().unwrap().supported_brightness()?; + let modes = aura.first().unwrap().supported_basic_modes()?; + let zones = aura.first().unwrap().supported_basic_zones()?; + let power = aura.first().unwrap().supported_power_zones()?; println!("Supported Keyboard Brightness:\n{:#?}", bright); println!("Supported Aura Modes:\n{:#?}", modes); println!("Supported Aura Zones:\n{:#?}", zones); @@ -459,14 +477,9 @@ fn verify_brightness(brightness: f32) { } fn handle_led_mode( - aura: &AuraProxyBlocking, + aura: &[AuraProxyBlocking], mode: &LedModeCommand, ) -> Result<(), Box> { - // if !supported.contains(&AURA_ZBUS_NAME.to_string()) { - // println!("This laptop does not support power options"); - // return Err(PlatformError::NotSupported.into()); - // } - if mode.command.is_none() && !mode.prev_mode && !mode.next_mode { if !mode.help { println!("Missing arg or command\n"); @@ -476,7 +489,8 @@ fn handle_led_mode( if let Some(cmdlist) = LedModeCommand::command_list() { let commands: Vec = cmdlist.lines().map(|s| s.to_owned()).collect(); - let modes = aura.supported_basic_modes()?; + // TODO: multiple rgb check + let modes = aura.first().unwrap().supported_basic_modes()?; for command in commands.iter().filter(|command| { for mode in &modes { if command @@ -505,68 +519,72 @@ fn handle_led_mode( return Ok(()); } if mode.next_mode { - let mode = aura.led_mode()?; - let modes = aura.supported_basic_modes()?; - let mut pos = modes.iter().position(|m| *m == mode).unwrap() + 1; - if pos >= modes.len() { - pos = 0; + for aura in aura { + let mode = aura.led_mode()?; + let modes = aura.supported_basic_modes()?; + let mut pos = modes.iter().position(|m| *m == mode).unwrap() + 1; + if pos >= modes.len() { + pos = 0; + } + aura.set_led_mode(modes[pos])?; } - aura.set_led_mode(modes[pos])?; } else if mode.prev_mode { - let mode = aura.led_mode()?; - let modes = aura.supported_basic_modes()?; - let mut pos = modes.iter().position(|m| *m == mode).unwrap(); - if pos == 0 { - pos = modes.len() - 1; - } else { - pos -= 1; + for aura in aura { + let mode = aura.led_mode()?; + let modes = aura.supported_basic_modes()?; + let mut pos = modes.iter().position(|m| *m == mode).unwrap(); + if pos == 0 { + pos = modes.len() - 1; + } else { + pos -= 1; + } + aura.set_led_mode(modes[pos])?; } - aura.set_led_mode(modes[pos])?; } else if let Some(mode) = mode.command.as_ref() { if mode.help_requested() { println!("{}", mode.self_usage()); return Ok(()); } - aura.set_led_mode_data(::from(mode))?; + for aura in aura { + aura.set_led_mode_data(::from(mode))?; + } } Ok(()) } fn handle_led_power1( - aura: &AuraProxyBlocking, + aura: &[AuraProxyBlocking], power: &LedPowerCommand1, ) -> Result<(), Box> { - // if !supported.contains(&AURA_ZBUS_NAME.to_string()) { - // println!("This laptop does not support power options"); - // return Err(PlatformError::NotSupported.into()); - // } - let dev_type = aura.device_type()?; - if !dev_type.is_old_style() && !dev_type.is_tuf_style() { - println!("This option applies only to keyboards 2021+"); - } - - if power.awake.is_none() - && power.sleep.is_none() - && power.boot.is_none() - && power.keyboard.is_none() - && power.lightbar.is_none() - { - if !power.help { - println!("Missing arg or command\n"); + for aura in aura { + let dev_type = aura.device_type()?; + if !dev_type.is_old_style() && !dev_type.is_tuf_style() { + println!("This option applies only to keyboards 2021+"); } - println!("{}\n", power.self_usage()); - return Ok(()); - } - if dev_type.is_old_style() { - handle_led_power_1_do_1866(aura, power)?; - return Ok(()); - } + if power.awake.is_none() + && power.sleep.is_none() + && power.boot.is_none() + && power.keyboard.is_none() + && power.lightbar.is_none() + { + if !power.help { + println!("Missing arg or command\n"); + } + println!("{}\n", power.self_usage()); + return Ok(()); + } - if dev_type.is_tuf_style() { - handle_led_power_1_do_tuf(aura, power)?; - return Ok(()); + if dev_type.is_old_style() { + handle_led_power_1_do_1866(aura, power)?; + return Ok(()); + } + + if dev_type.is_tuf_style() { + handle_led_power_1_do_tuf(aura, power)?; + return Ok(()); + } } println!("These options are for keyboards of product ID 0x1866 or TUF only"); @@ -600,7 +618,8 @@ fn handle_led_power_1_do_1866( old_rog: enabled, ..Default::default() }; - aura.set_led_power(data)?; // TODO: verify this + + aura.set_led_power(data.clone())?; // TODO: verify this Ok(()) } @@ -631,67 +650,66 @@ fn handle_led_power_1_do_tuf( tuf: enabled, ..Default::default() }; - aura.set_led_power(data)?; // TODO: verify this + aura.set_led_power(data.clone())?; // TODO: verify this Ok(()) } fn handle_led_power2( - aura: &AuraProxyBlocking, + aura: &[AuraProxyBlocking], power: &LedPowerCommand2, ) -> Result<(), Box> { - // if !supported.contains(&AURA_ZBUS_NAME.to_string()) { - // println!("This laptop does not support power options"); - // return Err(PlatformError::NotSupported.into()); - // } - let dev_type = aura.device_type()?; - if !dev_type.is_new_style() { - println!("This option applies only to keyboards 2021+"); - } - - if power.command().is_none() { - if !power.help { - println!("Missing arg or command\n"); + for aura in aura { + let dev_type = aura.device_type()?; + if !dev_type.is_new_style() { + println!("This option applies only to keyboards 2021+"); + continue; } - println!("{}\n", power.self_usage()); - println!("Commands available"); - if let Some(cmdlist) = LedPowerCommand2::command_list() { - let commands: Vec = cmdlist.lines().map(|s| s.to_owned()).collect(); - for command in &commands { - println!("{}", command); + if power.command().is_none() { + if !power.help { + println!("Missing arg or command\n"); } - } + println!("{}\n", power.self_usage()); + println!("Commands available"); - println!("\nHelp can also be requested on commands, e.g: boot --help"); - return Ok(()); - } + if let Some(cmdlist) = LedPowerCommand2::command_list() { + let commands: Vec = cmdlist.lines().map(|s| s.to_owned()).collect(); + for command in &commands { + println!("{}", command); + } + } - if let Some(pow) = power.command.as_ref() { - if pow.help_requested() { - println!("{}", pow.self_usage()); + println!("\nHelp can also be requested on commands, e.g: boot --help"); return Ok(()); } - let set = |power: &mut KbAuraPowerState, set_to: &AuraPowerStates| { - power.boot = set_to.boot; - power.awake = set_to.awake; - power.sleep = set_to.sleep; - power.shutdown = set_to.shutdown; - }; - - let mut enabled = aura.led_power()?; - if let Some(cmd) = &power.command { - match cmd { - aura_cli::SetAuraZoneEnabled::Keyboard(k) => set(&mut enabled.rog.keyboard, k), - aura_cli::SetAuraZoneEnabled::Logo(l) => set(&mut enabled.rog.logo, l), - aura_cli::SetAuraZoneEnabled::Lightbar(l) => set(&mut enabled.rog.lightbar, l), - aura_cli::SetAuraZoneEnabled::Lid(l) => set(&mut enabled.rog.lid, l), - aura_cli::SetAuraZoneEnabled::RearGlow(r) => set(&mut enabled.rog.rear_glow, r), + if let Some(pow) = power.command.as_ref() { + if pow.help_requested() { + println!("{}", pow.self_usage()); + return Ok(()); } - } - aura.set_led_power(enabled)?; + let set = |power: &mut KbAuraPowerState, set_to: &AuraPowerStates| { + power.boot = set_to.boot; + power.awake = set_to.awake; + power.sleep = set_to.sleep; + power.shutdown = set_to.shutdown; + }; + + let mut enabled = aura.led_power()?; + if let Some(cmd) = &power.command { + match cmd { + aura_cli::SetAuraZoneEnabled::Keyboard(k) => set(&mut enabled.rog.keyboard, k), + aura_cli::SetAuraZoneEnabled::Logo(l) => set(&mut enabled.rog.logo, l), + aura_cli::SetAuraZoneEnabled::Lightbar(l) => set(&mut enabled.rog.lightbar, l), + aura_cli::SetAuraZoneEnabled::Lid(l) => set(&mut enabled.rog.lid, l), + aura_cli::SetAuraZoneEnabled::RearGlow(r) => set(&mut enabled.rog.rear_glow, r), + } + } + + aura.set_led_power(enabled)?; + } } Ok(()) diff --git a/asusd/src/ctrl_aura/config.rs b/asusd/src/ctrl_aura/config.rs index 3119124a..97ee7607 100644 --- a/asusd/src/ctrl_aura/config.rs +++ b/asusd/src/ctrl_aura/config.rs @@ -116,7 +116,7 @@ pub struct AuraConfig { impl AuraConfig { /// Detect the keyboard type and load from default DB if data available pub fn new_with(prod_id: AuraDevice) -> Self { - info!("creating new AuraConfig"); + info!("Setting up AuraConfig for {prod_id:?}"); Self::from_default_support(prod_id, &LaptopLedData::get_data()) } } diff --git a/asusd/src/ctrl_aura/controller.rs b/asusd/src/ctrl_aura/controller.rs index a914b924..04b07f7f 100644 --- a/asusd/src/ctrl_aura/controller.rs +++ b/asusd/src/ctrl_aura/controller.rs @@ -2,9 +2,9 @@ use std::collections::BTreeMap; use config_traits::{StdConfig, StdConfigLoad}; use inotify::Inotify; -use log::info; +use log::{info, warn}; use rog_aura::advanced::{LedUsbPackets, UsbPackets}; -use rog_aura::aura_detection::{LaptopLedData, ASUS_KEYBOARD_DEVICES}; +use rog_aura::aura_detection::LaptopLedData; use rog_aura::usb::{AuraDevice, LED_APPLY, LED_SET}; use rog_aura::{AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN}; use rog_platform::hid_raw::HidRaw; @@ -59,71 +59,61 @@ pub struct CtrlKbdLed { } impl CtrlKbdLed { - pub fn new(data: LaptopLedData) -> Result { - let mut led_prod = AuraDevice::Unknown; - let mut usb_node = None; - for prod in ASUS_KEYBOARD_DEVICES { - match HidRaw::new(prod.into()) { - Ok(node) => { - led_prod = prod; - usb_node = Some(node); - info!( - "Looked for keyboard controller 0x{}: Found", - <&str>::from(prod) - ); - break; + pub fn find_all(data: &LaptopLedData) -> Result, RogError> { + let mut devices = Vec::new(); + + let mut enumerator = udev::Enumerator::new().map_err(|err| { + warn!("{}", err); + err + })?; + + enumerator.match_subsystem("hidraw").map_err(|err| { + warn!("{}", err); + err + })?; + + for end_point in enumerator.scan_devices()? { + if let Some(usb_device) = + end_point.parent_with_subsystem_devtype("usb", "usb_device")? + { + // Device is something like 002, while its parent is the MCU + // Think of it like the device is an endpoint of the USB device attached + if let Some(parent_id) = usb_device.attribute_value("idProduct") { + let prod_id = AuraDevice::from(parent_id.to_str().unwrap()); + if prod_id == AuraDevice::Unknown { + log::debug!("Unknown or invalid device: {parent_id:?}, skipping"); + continue; + } } - Err(err) => info!( - "Looked for keyboard controller 0x{}: {err}", - <&str>::from(prod) - ), + let dbus_path = dbus_path_for_dev(&usb_device).unwrap_or_default(); + let dev = HidRaw::from_device(end_point)?; + let dev = Self::from_hidraw(dev, dbus_path, data)?; + devices.push(dev); } } - let mut dbus_path = Default::default(); - let rgb_led = KeyboardLed::new()?; - let led_node = if let Some(rog) = usb_node { - info!("Found ROG USB keyboard"); - dbus_path = dbus_path_for_dev(rog.1).unwrap_or_default(); - LEDNode::Rog(rgb_led, rog.0) - } else if rgb_led.has_kbd_rgb_mode() { - info!("Found TUF keyboard"); - LEDNode::KbdLed(rgb_led.clone()) - } else { - return Err(RogError::NoAuraKeyboard); - // LEDNode::None - }; - - // New loads data from the DB also - let config = Self::init_config(led_prod, &data); - - let ctrl = CtrlKbdLed { - led_prod, - led_node, // on TUF this is the same as rgb_led / kd_brightness - supported_data: data, - per_key_mode_active: false, - config, - dbus_path, - }; - Ok(ctrl) + Ok(devices) } - pub fn from_device( + pub fn from_hidraw( device: HidRaw, dbus_path: OwnedObjectPath, - data: LaptopLedData, + data: &LaptopLedData, ) -> Result { let rgb_led = KeyboardLed::new()?; let prod_id = AuraDevice::from(device.prod_id()); + if prod_id == AuraDevice::Unknown { + log::error!("{} is AuraDevice::Unknown", device.prod_id()); + return Err(RogError::NoAuraNode); + } // New loads data from the DB also - let config = Self::init_config(prod_id, &data); + let config = Self::init_config(prod_id, data); let ctrl = CtrlKbdLed { led_prod: prod_id, - led_node: LEDNode::Rog(rgb_led, device), /* on TUF this is the same as rgb_led / - * kd_brightness */ - supported_data: data, + led_node: LEDNode::Rog(rgb_led, device), + supported_data: data.clone(), per_key_mode_active: false, config, dbus_path, @@ -348,7 +338,7 @@ mod tests { }; let mut controller = CtrlKbdLed { led_prod: AuraDevice::X19b6, - led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap()), + led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap().0), supported_data: supported_basic_modes, per_key_mode_active: false, config, @@ -386,7 +376,7 @@ mod tests { }; let mut controller = CtrlKbdLed { led_prod: AuraDevice::X19b6, - led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap()), + led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap().0), supported_data: supported_basic_modes, per_key_mode_active: false, config, diff --git a/asusd/src/ctrl_aura/manager.rs b/asusd/src/ctrl_aura/manager.rs index 52e021b1..304f663d 100644 --- a/asusd/src/ctrl_aura/manager.rs +++ b/asusd/src/ctrl_aura/manager.rs @@ -4,7 +4,7 @@ // - Add it to Zbus server // - If udev sees device removed then remove the zbus path -use std::collections::HashSet; +use std::collections::HashMap; use std::sync::Arc; use log::{error, info, warn}; @@ -26,7 +26,7 @@ use crate::{CtrlTask, Reloadable}; pub struct AuraManager { _connection: Connection, - _interfaces: Arc>>, + interfaces: Arc>>, } impl AuraManager { @@ -35,17 +35,13 @@ impl AuraManager { let data = LaptopLedData::get_data(); // Do the initial keyboard detection: - match CtrlKbdLed::new(data.clone()) { - Ok(ctrl) => { - let path = ctrl.dbus_path.clone(); - let sig_ctx = CtrlAuraZbus::signal_context(&connection)?; - let sig_ctx2 = sig_ctx.clone(); - let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); - start_tasks(zbus, &mut connection, sig_ctx2, &path).await?; - } - Err(err) => { - error!("Keyboard control: {}", err); - } + let all = CtrlKbdLed::find_all(&data)?; + for ctrl in all { + let path = ctrl.dbus_path.clone(); + let sig_ctx = CtrlAuraZbus::signal_context(&connection)?; + let sig_ctx2 = sig_ctx.clone(); + let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); + start_tasks(zbus, &mut connection, sig_ctx2, &path).await?; } // connection.object_server().at("/org/asuslinux", @@ -53,9 +49,10 @@ impl AuraManager { let manager = Self { _connection: connection, - _interfaces: Default::default(), + interfaces: Default::default(), }; + let interfaces_copy = manager.interfaces.clone(); // detect all plugged in aura devices (eventually) tokio::spawn(async move { let mut monitor = MonitorBuilder::new()?.match_subsystem("hidraw")?.listen()?; @@ -77,19 +74,24 @@ impl AuraManager { }; if action == "remove" { - if let Some(path) = dbus_path_for_dev(parent.clone()) { - info!("AuraManager removing: {path:?}"); + if let Some(id_product) = parent.attribute_value("idProduct") { + let id_product = id_product.to_string_lossy().to_string(); + let interfaces_copy = interfaces_copy.clone(); let conn_copy = conn_copy.clone(); tokio::spawn(async move { - let res = conn_copy - .object_server() - .remove::(&path) - .await - .map_err(|e| { - error!("Failed to remove {path:?}, {e:?}"); - e - })?; - info!("AuraManager removed: {path:?}, {res}"); + let mut interfaces = interfaces_copy.lock().await; + if let Some(path) = interfaces.remove(&id_product) { + info!("AuraManager removing: {path:?}"); + let res = conn_copy + .object_server() + .remove::(&path) + .await + .map_err(|e| { + error!("Failed to remove {path:?}, {e:?}"); + e + })?; + info!("AuraManager removed: {path:?}, {res}"); + } Ok::<(), RogError>(()) }); } @@ -97,7 +99,7 @@ impl AuraManager { let id_product = if let Some(id_product) = parent.attribute_value("idProduct") { - id_product + id_product.to_string_lossy().to_string() } else { continue; }; @@ -113,7 +115,7 @@ impl AuraManager { } // try conversion to known idProduct - let aura_device = AuraDevice::from(id_product.to_str().unwrap()); + let aura_device = AuraDevice::from(id_product.as_str()); if aura_device != AuraDevice::Unknown { if action == "add" { let dev_node = if let Some(dev_node) = event.devnode() { @@ -125,18 +127,21 @@ impl AuraManager { if let Ok(raw) = HidRaw::from_device(event.device()) .map_err(|e| error!("device path error: {e:?}")) { - let path = if let Some(path) = dbus_path_for_dev(parent) { + let path = if let Some(path) = dbus_path_for_dev(&parent) { path } else { continue; }; if let Ok(ctrl) = - CtrlKbdLed::from_device(raw, path.clone(), data.clone()) + CtrlKbdLed::from_hidraw(raw, path.clone(), &data) { info!("AuraManager found device at: {:?}", dev_node); let mut conn_copy = conn_copy.clone(); + let interfaces_copy = interfaces_copy.clone(); // tokio::spawn(async move { + let mut interfaces = interfaces_copy.lock().await; + interfaces.insert(id_product, path.clone()); let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); // Now add it to device list @@ -163,7 +168,7 @@ impl AuraManager { } } -pub(crate) fn dbus_path_for_dev(parent: Device) -> Option { +pub(crate) fn dbus_path_for_dev(parent: &Device) -> Option { if let Some(id_product) = parent.attribute_value("idProduct") { let id_product = id_product.to_string_lossy(); let path = if let Some(devnum) = parent.attribute_value("devnum") { diff --git a/rog-aura/data/aura_support.ron b/rog-aura/data/aura_support.ron index 39f39241..b675760e 100644 --- a/rog-aura/data/aura_support.ron +++ b/rog-aura/data/aura_support.ron @@ -719,6 +719,14 @@ advanced_type: None, power_zones: [Keyboard], ), + ( + board_name: "GZ301Z", + layout_name: "ga401q", + basic_modes: [Static, Breathe, Pulse], + basic_zones: [], + advanced_type: None, + power_zones: [Keyboard], + ), ( board_name: "RC71L", layout_name: "ga401q", diff --git a/rog-control-center/translations/en/rog-control-center.po b/rog-control-center/translations/en/rog-control-center.po index 2e9e2e33..39d99e73 100644 --- a/rog-control-center/translations/en/rog-control-center.po +++ b/rog-control-center/translations/en/rog-control-center.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-03-14 08:10+0000\n" +"POT-Creation-Date: 2024-03-22 04:35+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -12,42 +12,42 @@ msgstr "" "Language: \n" "Plural-Forms: nplurals=1; plural=0;\n" -#: rog-control-center/ui/main_window.slint:49 +#: rog-control-center/ui/main_window.slint:50 msgctxt "MainWindow" msgid "ROG" msgstr "" -#: rog-control-center/ui/main_window.slint:51 +#: rog-control-center/ui/main_window.slint:52 msgctxt "Menu1" msgid "System Control" msgstr "" -#: rog-control-center/ui/main_window.slint:52 +#: rog-control-center/ui/main_window.slint:53 msgctxt "Menu2" msgid "Keyboard Aura" msgstr "" -#: rog-control-center/ui/main_window.slint:53 +#: rog-control-center/ui/main_window.slint:54 msgctxt "Menu3" msgid "AniMe Matrix" msgstr "" -#: rog-control-center/ui/main_window.slint:54 +#: rog-control-center/ui/main_window.slint:55 msgctxt "Menu4" msgid "Fan Curves" msgstr "" -#: rog-control-center/ui/main_window.slint:55 +#: rog-control-center/ui/main_window.slint:56 msgctxt "Menu5" msgid "App Settings" msgstr "" -#: rog-control-center/ui/main_window.slint:56 +#: rog-control-center/ui/main_window.slint:57 msgctxt "Menu6" msgid "About" msgstr "" -#: rog-control-center/ui/main_window.slint:68 +#: rog-control-center/ui/main_window.slint:69 msgctxt "MainWindow" msgid "Quit" msgstr "" @@ -237,7 +237,7 @@ msgctxt "PageAura" msgid "Power Settings" msgstr "" -#: rog-control-center/ui/pages/aura.slint:211 rog-control-center/ui/pages/aura.slint:364 rog-control-center/ui/pages/aura.slint:424 +#: rog-control-center/ui/pages/aura.slint:211 rog-control-center/ui/pages/aura.slint:369 rog-control-center/ui/pages/aura.slint:434 msgctxt "PageAura" msgid "Keyboard" msgstr "" @@ -262,22 +262,22 @@ msgctxt "PageAura" msgid "Rear Glow" msgstr "" -#: rog-control-center/ui/pages/aura.slint:370 rog-control-center/ui/pages/aura.slint:430 +#: rog-control-center/ui/pages/aura.slint:375 rog-control-center/ui/pages/aura.slint:440 msgctxt "PageAura" msgid "Boot" msgstr "" -#: rog-control-center/ui/pages/aura.slint:375 rog-control-center/ui/pages/aura.slint:435 +#: rog-control-center/ui/pages/aura.slint:380 rog-control-center/ui/pages/aura.slint:445 msgctxt "PageAura" msgid "Awake" msgstr "" -#: rog-control-center/ui/pages/aura.slint:380 rog-control-center/ui/pages/aura.slint:440 +#: rog-control-center/ui/pages/aura.slint:385 rog-control-center/ui/pages/aura.slint:450 msgctxt "PageAura" msgid "Sleep" msgstr "" -#: rog-control-center/ui/pages/aura.slint:385 rog-control-center/ui/pages/aura.slint:445 +#: rog-control-center/ui/pages/aura.slint:390 rog-control-center/ui/pages/aura.slint:455 msgctxt "PageAura" msgid "Shutdown" msgstr "" @@ -447,42 +447,42 @@ msgctxt "nv_temp_target" msgid "nv_temp_target" msgstr "" -#: rog-control-center/ui/pages/system.slint:289 +#: rog-control-center/ui/pages/system.slint:290 msgctxt "PageSystem" msgid "Energy Performance Preference linked to Throttle Policy" msgstr "" -#: rog-control-center/ui/pages/system.slint:293 +#: rog-control-center/ui/pages/system.slint:294 msgctxt "PageSystem" msgid "Change EPP based on Throttle Policy" msgstr "" -#: rog-control-center/ui/pages/system.slint:301 +#: rog-control-center/ui/pages/system.slint:302 msgctxt "PageSystem" msgid "EPP for Balanced Policy" msgstr "" -#: rog-control-center/ui/pages/system.slint:311 +#: rog-control-center/ui/pages/system.slint:312 msgctxt "PageSystem" msgid "EPP for Performance Policy" msgstr "" -#: rog-control-center/ui/pages/system.slint:321 +#: rog-control-center/ui/pages/system.slint:322 msgctxt "PageSystem" msgid "EPP for Quiet Policy" msgstr "" -#: rog-control-center/ui/pages/system.slint:339 +#: rog-control-center/ui/pages/system.slint:340 msgctxt "PageSystem" msgid "Throttle Policy for power state" msgstr "" -#: rog-control-center/ui/pages/system.slint:343 +#: rog-control-center/ui/pages/system.slint:344 msgctxt "PageSystem" msgid "Throttle Policy on Battery" msgstr "" -#: rog-control-center/ui/pages/system.slint:353 +#: rog-control-center/ui/pages/system.slint:354 msgctxt "PageSystem" msgid "Throttle Policy on AC" msgstr "" diff --git a/rog-platform/examples/ally-gamepad-calibration.rs b/rog-platform/examples/ally-gamepad-calibration.rs index c70ed9f2..89d4e196 100644 --- a/rog-platform/examples/ally-gamepad-calibration.rs +++ b/rog-platform/examples/ally-gamepad-calibration.rs @@ -24,7 +24,7 @@ pub fn main() -> Result<(), Box> { return Err("RogError::NoAuraKeyboard".into()); } - let node = usb_node.unwrap(); + let node = usb_node.unwrap().0; let mut packet: [u8; 64] = [ 0x5a, 0xd1, 0x0d, 0x0e, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/rog-platform/examples/ally-gamepad-mode-changes.rs b/rog-platform/examples/ally-gamepad-mode-changes.rs index 112e71b5..5e84d67c 100644 --- a/rog-platform/examples/ally-gamepad-mode-changes.rs +++ b/rog-platform/examples/ally-gamepad-mode-changes.rs @@ -26,7 +26,7 @@ pub fn main() -> Result<(), Box> { return Err("RogError::NoAuraKeyboard".into()); } - let node = usb_node.unwrap(); + let node = usb_node.unwrap().0; // node.write_bytes(&[0x5a, 0xd1, 0x0a, 0x01])?; // TODO: need to CHECK println!("Set mouse mode for 10 seconds"); diff --git a/rog-platform/examples/ally-set-qam-secondary.rs b/rog-platform/examples/ally-set-qam-secondary.rs index c3365ea8..dcc7121b 100644 --- a/rog-platform/examples/ally-set-qam-secondary.rs +++ b/rog-platform/examples/ally-set-qam-secondary.rs @@ -24,7 +24,7 @@ pub fn main() -> Result<(), Box> { return Err("RogError::NoAuraKeyboard".into()); } - let node = usb_node.unwrap(); + let node = usb_node.unwrap().0; // node.write_bytes(&[0x5a, 0xd1, 0x0a, 0x01])?; // TODO: need to CHECK println!("Set mouse mode for 10 seconds"); diff --git a/rog-platform/src/hid_raw.rs b/rog-platform/src/hid_raw.rs index 40de1c5d..fa266399 100644 --- a/rog-platform/src/hid_raw.rs +++ b/rog-platform/src/hid_raw.rs @@ -27,35 +27,36 @@ impl HidRaw { PlatformError::Udev("match_subsystem failed".into(), err) })?; - for device in enumerator + for endpoint in enumerator .scan_devices() .map_err(|e| PlatformError::IoPath("enumerator".to_owned(), e))? { - if let Some(parent_device) = device + if let Some(usb_device) = endpoint .parent_with_subsystem_devtype("usb", "usb_device") .map_err(|e| { - PlatformError::IoPath(device.devpath().to_string_lossy().to_string(), e) - })? { - if let Some(parent) = parent_device.attribute_value("idProduct") { - if parent == id_product { - if let Some(dev_node) = device.devnode() { + PlatformError::IoPath(endpoint.devpath().to_string_lossy().to_string(), e) + })? + { + if let Some(parent_id) = usb_device.attribute_value("idProduct") { + if parent_id == id_product { + if let Some(dev_node) = endpoint.devnode() { info!("Using device at: {:?} for hidraw control", dev_node); return Ok(( Self { devfs_path: UnsafeCell::new(dev_node.to_owned()), prod_id: id_product.to_string(), - syspath: device.syspath().into(), + syspath: endpoint.syspath().into(), }, - parent_device, + usb_device, )); } } } } else { // Try to see if there is a virtual device created with uhid for testing - let dev_path = device.devpath().to_string_lossy(); + let dev_path = endpoint.devpath().to_string_lossy(); if dev_path.contains("virtual") && dev_path.contains(&id_product.to_uppercase()) { - if let Some(dev_node) = device.devnode() { + if let Some(dev_node) = endpoint.devnode() { info!( "Using device at: {:?} for control", dev_node @@ -64,9 +65,9 @@ impl HidRaw { Self { devfs_path: UnsafeCell::new(dev_node.to_owned()), prod_id: id_product.to_string(), - syspath: device.syspath().into(), + syspath: endpoint.syspath().into(), }, - device, + endpoint, )); } } From 4e778a3d28c005965dd4cd5cfcd4d8258237cd79 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Fri, 22 Mar 2024 19:47:24 +1300 Subject: [PATCH 02/11] Refactor HidRaw --- .../translations/en/rog-control-center.po | 2 +- rog-platform/src/hid_raw.rs | 69 +++++++++---------- 2 files changed, 32 insertions(+), 39 deletions(-) diff --git a/rog-control-center/translations/en/rog-control-center.po b/rog-control-center/translations/en/rog-control-center.po index 39d99e73..cc0dd044 100644 --- a/rog-control-center/translations/en/rog-control-center.po +++ b/rog-control-center/translations/en/rog-control-center.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-03-22 04:35+0000\n" +"POT-Creation-Date: 2024-03-22 06:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/rog-platform/src/hid_raw.rs b/rog-platform/src/hid_raw.rs index fa266399..8218a051 100644 --- a/rog-platform/src/hid_raw.rs +++ b/rog-platform/src/hid_raw.rs @@ -1,18 +1,24 @@ -use std::cell::UnsafeCell; -use std::fs::OpenOptions; +use std::cell::RefCell; +use std::fs::{File, OpenOptions}; use std::io::Write; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; use log::{info, warn}; use udev::Device; use crate::error::{PlatformError, Result}; +/// A USB device that utilizes hidraw for I/O #[derive(Debug)] pub struct HidRaw { - devfs_path: UnsafeCell, + /// The path to the `/dev/` of the device + devfs_path: PathBuf, + /// The sysfs path syspath: PathBuf, + /// The product ID. The vendor ID is not kept prod_id: String, + /// Retaining a handle to the file for the duration of `HidRaw` + file: RefCell, } impl HidRaw { @@ -43,7 +49,10 @@ impl HidRaw { info!("Using device at: {:?} for hidraw control", dev_node); return Ok(( Self { - devfs_path: UnsafeCell::new(dev_node.to_owned()), + file: RefCell::new( + OpenOptions::new().write(true).open(dev_node)?, + ), + devfs_path: dev_node.to_owned(), prod_id: id_product.to_string(), syspath: endpoint.syspath().into(), }, @@ -63,7 +72,8 @@ impl HidRaw { ); return Ok(( Self { - devfs_path: UnsafeCell::new(dev_node.to_owned()), + file: RefCell::new(OpenOptions::new().write(true).open(dev_node)?), + devfs_path: dev_node.to_owned(), prod_id: id_product.to_string(), syspath: endpoint.syspath().into(), }, @@ -79,6 +89,7 @@ impl HidRaw { ))) } + /// Make `HidRaw` device from a udev device pub fn from_device(device: Device) -> Result { if let Some(parent) = device .parent_with_subsystem_devtype("usb", "usb_device") @@ -87,7 +98,8 @@ impl HidRaw { if let Some(dev_node) = device.devnode() { if let Some(id_product) = parent.attribute_value("idProduct") { return Ok(Self { - devfs_path: UnsafeCell::new(dev_node.to_owned()), + file: RefCell::new(OpenOptions::new().write(true).open(dev_node)?), + devfs_path: dev_node.to_owned(), prod_id: id_product.to_string_lossy().into(), syspath: device.syspath().into(), }); @@ -103,41 +115,22 @@ impl HidRaw { &self.prod_id } - pub fn devfs_path(&self) -> PathBuf { - unsafe { &*(self.devfs_path.get()) }.clone() - } - - pub fn syspath(&self) -> &Path { - &self.syspath - } - + /// Write an array of raw bytes to the device using the hidraw interface pub fn write_bytes(&self, message: &[u8]) -> Result<()> { - let mut path = unsafe { &*(self.devfs_path.get()) }; - let mut file = match OpenOptions::new().write(true).open(path) { - Ok(f) => f, - Err(e) => { - warn!( - "write_bytes failed for {:?}, trying again: {e}", - self.devfs_path - ); - unsafe { - *(self.devfs_path.get()) = - (*(Self::new(&self.prod_id)?.0.devfs_path.get())).clone(); - path = &mut *(self.devfs_path.get()); - } - OpenOptions::new() - .write(true) - .open(path) - .map_err(|e| PlatformError::IoPath(path.to_string_lossy().to_string(), e))? - } - }; - file.write_all(message) - .map_err(|e| PlatformError::IoPath(path.to_string_lossy().to_string(), e)) + if let Ok(mut file) = self.file.try_borrow_mut() { + // let mut file = self.file.borrow_mut(); + // TODO: re-get the file if error? + file.write_all(message).map_err(|e| { + PlatformError::IoPath(self.devfs_path.to_string_lossy().to_string(), e) + })?; + } + Ok(()) } + /// This method was added for certain devices like AniMe to prevent them + /// waking the laptop pub fn set_wakeup_disabled(&self) -> Result<()> { - let path = unsafe { &*(self.devfs_path.get()) }; - let mut dev = Device::from_syspath(path)?; + let mut dev = Device::from_syspath(&self.syspath)?; Ok(dev.set_attribute_value("power/wakeup", "disabled")?) } } From 193f9dfa1eeb66656a565df162c4033015f7afca Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sat, 23 Mar 2024 11:27:20 +1300 Subject: [PATCH 03/11] Extra logging for aura --- asusd/src/ctrl_aura/config.rs | 4 ---- asusd/src/ctrl_aura/controller.rs | 3 ++- asusd/src/ctrl_aura/manager.rs | 3 ++- rog-control-center/translations/en/rog-control-center.po | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/asusd/src/ctrl_aura/config.rs b/asusd/src/ctrl_aura/config.rs index 97ee7607..39676537 100644 --- a/asusd/src/ctrl_aura/config.rs +++ b/asusd/src/ctrl_aura/config.rs @@ -142,10 +142,6 @@ impl StdConfig for AuraConfig { impl StdConfigLoad for AuraConfig {} impl AuraConfig { - pub fn set_filename(&mut self, prod_id: AuraDevice) { - self.config_name = format!("aura_{prod_id:?}.ron"); - } - pub fn from_default_support(prod_id: AuraDevice, support_data: &LaptopLedData) -> Self { // create a default config here let enabled = if prod_id.is_new_style() { diff --git a/asusd/src/ctrl_aura/controller.rs b/asusd/src/ctrl_aura/controller.rs index 04b07f7f..581d655f 100644 --- a/asusd/src/ctrl_aura/controller.rs +++ b/asusd/src/ctrl_aura/controller.rs @@ -60,6 +60,7 @@ pub struct CtrlKbdLed { impl CtrlKbdLed { pub fn find_all(data: &LaptopLedData) -> Result, RogError> { + info!("Searching for all Aura devices"); let mut devices = Vec::new(); let mut enumerator = udev::Enumerator::new().map_err(|err| { @@ -91,6 +92,7 @@ impl CtrlKbdLed { devices.push(dev); } } + info!("Found {} Aura devices", devices.len()); Ok(devices) } @@ -126,7 +128,6 @@ impl CtrlKbdLed { let mut config_init = AuraConfig::new_with(prod_id); // config_init.set_filename(prod_id); let mut config_loaded = config_init.clone().load(); - config_loaded.set_filename(prod_id); // update the initialised data with what we loaded from disk for mode in &mut config_init.builtins { // update init values from loaded values if they exist diff --git a/asusd/src/ctrl_aura/manager.rs b/asusd/src/ctrl_aura/manager.rs index 304f663d..21a737aa 100644 --- a/asusd/src/ctrl_aura/manager.rs +++ b/asusd/src/ctrl_aura/manager.rs @@ -7,7 +7,7 @@ use std::collections::HashMap; use std::sync::Arc; -use log::{error, info, warn}; +use log::{debug, error, info, warn}; use mio::{Events, Interest, Poll, Token}; use rog_aura::aura_detection::LaptopLedData; use rog_aura::usb::AuraDevice; @@ -146,6 +146,7 @@ impl AuraManager { let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); // Now add it to device list let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; + debug!("Starting Aura at {path}"); start_tasks(zbus, &mut conn_copy, sig_ctx, &path) .await?; Ok::<(), RogError>(()) diff --git a/rog-control-center/translations/en/rog-control-center.po b/rog-control-center/translations/en/rog-control-center.po index cc0dd044..8afcdd0f 100644 --- a/rog-control-center/translations/en/rog-control-center.po +++ b/rog-control-center/translations/en/rog-control-center.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-03-22 06:44+0000\n" +"POT-Creation-Date: 2024-03-22 06:45+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From 1c007b421674c28a92428c476d6e3863c378f420 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sat, 23 Mar 2024 11:45:20 +1300 Subject: [PATCH 04/11] Small refinement to aura control init --- asusd/src/ctrl_aura/controller.rs | 9 ++++++++- rog-control-center/translations/en/rog-control-center.po | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/asusd/src/ctrl_aura/controller.rs b/asusd/src/ctrl_aura/controller.rs index 581d655f..31105d41 100644 --- a/asusd/src/ctrl_aura/controller.rs +++ b/asusd/src/ctrl_aura/controller.rs @@ -2,7 +2,7 @@ use std::collections::BTreeMap; use config_traits::{StdConfig, StdConfigLoad}; use inotify::Inotify; -use log::{info, warn}; +use log::{debug, info, warn}; use rog_aura::advanced::{LedUsbPackets, UsbPackets}; use rog_aura::aura_detection::LaptopLedData; use rog_aura::usb::{AuraDevice, LED_APPLY, LED_SET}; @@ -86,6 +86,13 @@ impl CtrlKbdLed { continue; } } + let dev_node = if let Some(dev_node) = usb_device.devnode() { + dev_node + } else { + debug!("Device has no devnode, skipping"); + continue; + }; + info!("AuraControl found device at: {:?}", dev_node); let dbus_path = dbus_path_for_dev(&usb_device).unwrap_or_default(); let dev = HidRaw::from_device(end_point)?; let dev = Self::from_hidraw(dev, dbus_path, data)?; diff --git a/rog-control-center/translations/en/rog-control-center.po b/rog-control-center/translations/en/rog-control-center.po index 8afcdd0f..93cb683b 100644 --- a/rog-control-center/translations/en/rog-control-center.po +++ b/rog-control-center/translations/en/rog-control-center.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-03-22 06:45+0000\n" +"POT-Creation-Date: 2024-03-22 22:27+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From 4b38e5daa6a97d0fbd8394efbf276b4de2c0cf4d Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sat, 23 Mar 2024 13:07:20 +1300 Subject: [PATCH 05/11] Further adjustments to aura --- asusd/src/ctrl_aura/manager.rs | 10 ++++++---- rog-aura/src/usb.rs | 2 +- .../translations/en/rog-control-center.po | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/asusd/src/ctrl_aura/manager.rs b/asusd/src/ctrl_aura/manager.rs index 21a737aa..e2dfd6ca 100644 --- a/asusd/src/ctrl_aura/manager.rs +++ b/asusd/src/ctrl_aura/manager.rs @@ -26,18 +26,20 @@ use crate::{CtrlTask, Reloadable}; pub struct AuraManager { _connection: Connection, - interfaces: Arc>>, + interfaces: Arc>>, } impl AuraManager { pub async fn new(mut connection: Connection) -> Result { let conn_copy = connection.clone(); let data = LaptopLedData::get_data(); + let mut interfaces = HashMap::new(); // Do the initial keyboard detection: let all = CtrlKbdLed::find_all(&data)?; for ctrl in all { let path = ctrl.dbus_path.clone(); + interfaces.insert(ctrl.led_prod, path.clone()); // ensure we record the initial stuff let sig_ctx = CtrlAuraZbus::signal_context(&connection)?; let sig_ctx2 = sig_ctx.clone(); let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); @@ -49,7 +51,7 @@ impl AuraManager { let manager = Self { _connection: connection, - interfaces: Default::default(), + interfaces: Arc::new(Mutex::new(interfaces)), }; let interfaces_copy = manager.interfaces.clone(); @@ -75,7 +77,7 @@ impl AuraManager { if action == "remove" { if let Some(id_product) = parent.attribute_value("idProduct") { - let id_product = id_product.to_string_lossy().to_string(); + let id_product = AuraDevice::from(id_product.to_str().unwrap()); let interfaces_copy = interfaces_copy.clone(); let conn_copy = conn_copy.clone(); tokio::spawn(async move { @@ -141,7 +143,7 @@ impl AuraManager { // tokio::spawn(async move { let mut interfaces = interfaces_copy.lock().await; - interfaces.insert(id_product, path.clone()); + interfaces.insert(aura_device, path.clone()); let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); // Now add it to device list diff --git a/rog-aura/src/usb.rs b/rog-aura/src/usb.rs index 552418e4..19944b41 100644 --- a/rog-aura/src/usb.rs +++ b/rog-aura/src/usb.rs @@ -31,7 +31,7 @@ pub const fn aura_brightness_bytes(brightness: u8) -> [u8; 17] { derive(Type, Value, OwnedValue), zvariant(signature = "s") )] -#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Default)] pub enum AuraDevice { Tuf = 0, X1854 = 1, diff --git a/rog-control-center/translations/en/rog-control-center.po b/rog-control-center/translations/en/rog-control-center.po index 93cb683b..8670e830 100644 --- a/rog-control-center/translations/en/rog-control-center.po +++ b/rog-control-center/translations/en/rog-control-center.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-03-22 22:27+0000\n" +"POT-Creation-Date: 2024-03-22 22:45+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From ac605cbc00c818c0bf0398cc02134c38916a0f98 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sat, 23 Mar 2024 14:30:00 +1300 Subject: [PATCH 06/11] Narrow the search space of aura devices down --- asusd/src/ctrl_aura/controller.rs | 29 ++++++++++++++----- .../translations/en/rog-control-center.po | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/asusd/src/ctrl_aura/controller.rs b/asusd/src/ctrl_aura/controller.rs index 31105d41..2d01bead 100644 --- a/asusd/src/ctrl_aura/controller.rs +++ b/asusd/src/ctrl_aura/controller.rs @@ -1,4 +1,4 @@ -use std::collections::BTreeMap; +use std::collections::{BTreeMap, HashSet}; use config_traits::{StdConfig, StdConfigLoad}; use inotify::Inotify; @@ -62,6 +62,7 @@ impl CtrlKbdLed { pub fn find_all(data: &LaptopLedData) -> Result, RogError> { info!("Searching for all Aura devices"); let mut devices = Vec::new(); + let mut found = HashSet::new(); let mut enumerator = udev::Enumerator::new().map_err(|err| { warn!("{}", err); @@ -74,18 +75,32 @@ impl CtrlKbdLed { })?; for end_point in enumerator.scan_devices()? { + // usb_device gives us a product and vendor ID if let Some(usb_device) = end_point.parent_with_subsystem_devtype("usb", "usb_device")? { - // Device is something like 002, while its parent is the MCU - // Think of it like the device is an endpoint of the USB device attached - if let Some(parent_id) = usb_device.attribute_value("idProduct") { - let prod_id = AuraDevice::from(parent_id.to_str().unwrap()); - if prod_id == AuraDevice::Unknown { - log::debug!("Unknown or invalid device: {parent_id:?}, skipping"); + // The asus_wmi driver latches MCU that controls the USB endpoints + if let Some(parent) = end_point.parent() { + if let Some(driver) = parent.driver() { + // There is a tree of devices added so filter by driver + if driver != "asus" { + continue; + } + } else { continue; } } + // Device is something like 002, while its parent is the MCU + // Think of it like the device is an endpoint of the USB device attached + if let Some(usb_id) = usb_device.attribute_value("idProduct") { + let prod_id = AuraDevice::from(usb_id.to_str().unwrap()); + if prod_id == AuraDevice::Unknown || found.contains(&prod_id) { + log::debug!("Unknown or invalid device: {usb_id:?}, skipping"); + continue; + } + found.insert(prod_id); + } + let dev_node = if let Some(dev_node) = usb_device.devnode() { dev_node } else { diff --git a/rog-control-center/translations/en/rog-control-center.po b/rog-control-center/translations/en/rog-control-center.po index 8670e830..588c7c76 100644 --- a/rog-control-center/translations/en/rog-control-center.po +++ b/rog-control-center/translations/en/rog-control-center.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2024-03-22 22:45+0000\n" +"POT-Creation-Date: 2024-03-23 01:29+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From 4b34ab83fb9fbe1ebe3c6cd3ef342cae4615e3b7 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sat, 23 Mar 2024 23:15:38 +1300 Subject: [PATCH 07/11] Initial pass of async task sync in aura --- asusd/src/ctrl_aura/config.rs | 8 +- asusd/src/ctrl_aura/controller.rs | 21 +++-- asusd/src/ctrl_aura/manager.rs | 125 +++++++++++++++++------------ asusd/src/ctrl_aura/trait_impls.rs | 49 ++++++----- asusd/src/ctrl_platform.rs | 10 +-- 5 files changed, 126 insertions(+), 87 deletions(-) diff --git a/asusd/src/ctrl_aura/config.rs b/asusd/src/ctrl_aura/config.rs index 39676537..09c9e59a 100644 --- a/asusd/src/ctrl_aura/config.rs +++ b/asusd/src/ctrl_aura/config.rs @@ -18,6 +18,12 @@ pub enum AuraPowerConfig { AuraDevRog2(AuraPower), } +impl Default for AuraPowerConfig { + fn default() -> Self { + Self::AuraDevTuf(HashSet::default()) + } +} + impl AuraPowerConfig { /// Invalid for TUF laptops pub fn to_bytes(control: &Self) -> [u8; 4] { @@ -101,7 +107,7 @@ impl From<&AuraPowerConfig> for AuraPowerDev { } } -#[derive(Deserialize, Serialize, Debug, Clone)] +#[derive(Deserialize, Serialize, Default, Debug, Clone)] // #[serde(default)] pub struct AuraConfig { pub config_name: String, diff --git a/asusd/src/ctrl_aura/controller.rs b/asusd/src/ctrl_aura/controller.rs index 2d01bead..37283ab0 100644 --- a/asusd/src/ctrl_aura/controller.rs +++ b/asusd/src/ctrl_aura/controller.rs @@ -62,7 +62,7 @@ impl CtrlKbdLed { pub fn find_all(data: &LaptopLedData) -> Result, RogError> { info!("Searching for all Aura devices"); let mut devices = Vec::new(); - let mut found = HashSet::new(); + let mut found = HashSet::new(); // track and ensure we use only one hidraw per prod_id let mut enumerator = udev::Enumerator::new().map_err(|err| { warn!("{}", err); @@ -92,13 +92,14 @@ impl CtrlKbdLed { } // Device is something like 002, while its parent is the MCU // Think of it like the device is an endpoint of the USB device attached + let mut aura_dev = AuraDevice::Unknown; if let Some(usb_id) = usb_device.attribute_value("idProduct") { - let prod_id = AuraDevice::from(usb_id.to_str().unwrap()); - if prod_id == AuraDevice::Unknown || found.contains(&prod_id) { + aura_dev = AuraDevice::from(usb_id.to_str().unwrap()); + if aura_dev == AuraDevice::Unknown || found.contains(&aura_dev) { log::debug!("Unknown or invalid device: {usb_id:?}, skipping"); continue; } - found.insert(prod_id); + found.insert(aura_dev); } let dev_node = if let Some(dev_node) = usb_device.devnode() { @@ -110,7 +111,8 @@ impl CtrlKbdLed { info!("AuraControl found device at: {:?}", dev_node); let dbus_path = dbus_path_for_dev(&usb_device).unwrap_or_default(); let dev = HidRaw::from_device(end_point)?; - let dev = Self::from_hidraw(dev, dbus_path, data)?; + let mut dev = Self::from_hidraw(dev, dbus_path, data)?; + dev.config = Self::init_config(aura_dev, data); devices.push(dev); } } @@ -119,6 +121,9 @@ impl CtrlKbdLed { Ok(devices) } + /// The generated data from this function has a default config. This config + /// should be overwritten. The reason for the default config is because + /// of async issues between this and udev/hidraw pub fn from_hidraw( device: HidRaw, dbus_path: OwnedObjectPath, @@ -132,20 +137,20 @@ impl CtrlKbdLed { } // New loads data from the DB also - let config = Self::init_config(prod_id, data); + // let config = Self::init_config(prod_id, data); let ctrl = CtrlKbdLed { led_prod: prod_id, led_node: LEDNode::Rog(rgb_led, device), supported_data: data.clone(), per_key_mode_active: false, - config, + config: AuraConfig::default(), dbus_path, }; Ok(ctrl) } - fn init_config(prod_id: AuraDevice, supported_basic_modes: &LaptopLedData) -> AuraConfig { + pub fn init_config(prod_id: AuraDevice, supported_basic_modes: &LaptopLedData) -> AuraConfig { // New loads data from the DB also let mut config_init = AuraConfig::new_with(prod_id); // config_init.set_filename(prod_id); diff --git a/asusd/src/ctrl_aura/manager.rs b/asusd/src/ctrl_aura/manager.rs index e2dfd6ca..6a518ba3 100644 --- a/asusd/src/ctrl_aura/manager.rs +++ b/asusd/src/ctrl_aura/manager.rs @@ -4,7 +4,7 @@ // - Add it to Zbus server // - If udev sees device removed then remove the zbus path -use std::collections::HashMap; +use std::collections::HashSet; use std::sync::Arc; use log::{debug, error, info, warn}; @@ -26,20 +26,19 @@ use crate::{CtrlTask, Reloadable}; pub struct AuraManager { _connection: Connection, - interfaces: Arc>>, } impl AuraManager { pub async fn new(mut connection: Connection) -> Result { let conn_copy = connection.clone(); let data = LaptopLedData::get_data(); - let mut interfaces = HashMap::new(); + let mut interfaces = HashSet::new(); // Do the initial keyboard detection: let all = CtrlKbdLed::find_all(&data)?; for ctrl in all { let path = ctrl.dbus_path.clone(); - interfaces.insert(ctrl.led_prod, path.clone()); // ensure we record the initial stuff + interfaces.insert(path.clone()); // ensure we record the initial stuff let sig_ctx = CtrlAuraZbus::signal_context(&connection)?; let sig_ctx2 = sig_ctx.clone(); let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); @@ -51,11 +50,10 @@ impl AuraManager { let manager = Self { _connection: connection, - interfaces: Arc::new(Mutex::new(interfaces)), }; - let interfaces_copy = manager.interfaces.clone(); // detect all plugged in aura devices (eventually) + let interfaces = Arc::new(Mutex::new(interfaces)); tokio::spawn(async move { let mut monitor = MonitorBuilder::new()?.match_subsystem("hidraw")?.listen()?; let mut poll = Poll::new()?; @@ -64,8 +62,13 @@ impl AuraManager { .register(&mut monitor, Token(0), Interest::READABLE)?; loop { - poll.poll(&mut events, None).unwrap(); + if poll.poll(&mut events, None).is_err() { + continue; + } for event in monitor.iter() { + if event.parent_with_subsystem("hidraw").is_err() { + continue; + } if let Some(parent) = event.parent_with_subsystem_devtype("usb", "usb_device")? { @@ -75,51 +78,62 @@ impl AuraManager { continue; }; + let path = if let Some(path) = dbus_path_for_dev(&parent) { + path + } else { + continue; + }; + if action == "remove" { - if let Some(id_product) = parent.attribute_value("idProduct") { - let id_product = AuraDevice::from(id_product.to_str().unwrap()); - let interfaces_copy = interfaces_copy.clone(); + dbg!("REMOVING"); + if let Some(_) = parent.attribute_value("idProduct") { + info!("AuraManager removing: {path:?}"); let conn_copy = conn_copy.clone(); + let interfaces_copy = interfaces.clone(); tokio::spawn(async move { let mut interfaces = interfaces_copy.lock().await; - if let Some(path) = interfaces.remove(&id_product) { - info!("AuraManager removing: {path:?}"); - let res = conn_copy - .object_server() - .remove::(&path) - .await - .map_err(|e| { - error!("Failed to remove {path:?}, {e:?}"); - e - })?; - info!("AuraManager removed: {path:?}, {res}"); - } + let res = conn_copy + .object_server() + .remove::(&path) + .await + .map_err(|e| { + error!("Failed to remove {path:?}, {e:?}"); + e + })?; + info!("AuraManager removed: {path:?}, {res}"); + interfaces.remove(&path); + debug!("Removed {path:?}"); Ok::<(), RogError>(()) }); } - } - - let id_product = - if let Some(id_product) = parent.attribute_value("idProduct") { - id_product.to_string_lossy().to_string() - } else { - continue; - }; - if let Some(p2) = event.parent() { - if let Some(driver) = p2.driver() { - // There is a tree of devices added so filter by driver - if driver != "asus" { + } else if action == "add" { + dbg!("ADDING"); + let id_product = + if let Some(id_product) = parent.attribute_value("idProduct") { + id_product.to_string_lossy().to_string() + } else { + continue; + }; + if let Some(p2) = event.parent() { + if let Some(driver) = p2.driver() { + // There is a tree of devices added so filter by driver + if driver != "asus" { + continue; + } + } else { continue; } - } else { - continue; } - } - // try conversion to known idProduct - let aura_device = AuraDevice::from(id_product.as_str()); - if aura_device != AuraDevice::Unknown { - if action == "add" { + // try conversion to known idProduct + let aura_device = AuraDevice::from(id_product.as_str()); + if aura_device != AuraDevice::Unknown { + let path = if let Some(path) = dbus_path_for_dev(&parent) { + path + } else { + continue; + }; + let dev_node = if let Some(dev_node) = event.devnode() { dev_node } else { @@ -129,26 +143,31 @@ impl AuraManager { if let Ok(raw) = HidRaw::from_device(event.device()) .map_err(|e| error!("device path error: {e:?}")) { - let path = if let Some(path) = dbus_path_for_dev(&parent) { - path - } else { - continue; - }; - if let Ok(ctrl) = + // bah... shitty clone TODO: fix + let data_clone = data.clone(); + if let Ok(mut ctrl) = CtrlKbdLed::from_hidraw(raw, path.clone(), &data) { - info!("AuraManager found device at: {:?}", dev_node); + info!( + "AuraManager found device at: {dev_node:?}, {path:?}" + ); let mut conn_copy = conn_copy.clone(); - let interfaces_copy = interfaces_copy.clone(); + let interfaces_copy = interfaces.clone(); // tokio::spawn(async move { let mut interfaces = interfaces_copy.lock().await; - interfaces.insert(aura_device, path.clone()); + if interfaces.contains(&path) { + debug!("Already a ctrl at {path:?}"); + return Ok(()); + } + debug!("Starting Aura at {path}"); + interfaces.insert(path.clone()); let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; + ctrl.config = + CtrlKbdLed::init_config(aura_device, &data_clone); let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); // Now add it to device list let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; - debug!("Starting Aura at {path}"); start_tasks(zbus, &mut conn_copy, sig_ctx, &path) .await?; Ok::<(), RogError>(()) @@ -156,9 +175,9 @@ impl AuraManager { // MonitorSocket } } + } else { + warn!("idProduct:{id_product:?} is unknown, not using") } - } else { - warn!("idProduct:{id_product:?} is unknown, not using") } } } diff --git a/asusd/src/ctrl_aura/trait_impls.rs b/asusd/src/ctrl_aura/trait_impls.rs index 2f852d61..2f2fa805 100644 --- a/asusd/src/ctrl_aura/trait_impls.rs +++ b/asusd/src/ctrl_aura/trait_impls.rs @@ -210,23 +210,29 @@ impl CtrlTask for CtrlAuraZbus { } async fn create_tasks(&self, _: SignalContext<'static>) -> Result<(), RogError> { - let load_save = |start: bool, mut lock: MutexGuard<'_, CtrlKbdLed>| { - // If waking up - if !start { - info!("CtrlKbdLedTask reloading brightness and modes"); - lock.led_node - .set_brightness(lock.config.brightness.into()) - .map_err(|e| error!("CtrlKbdLedTask: {e}")) - .ok(); - lock.write_current_config_mode() - .map_err(|e| error!("CtrlKbdLedTask: {e}")) - .ok(); - } else if start { - Self::update_config(&mut lock) - .map_err(|e| error!("CtrlKbdLedTask: {e}")) - .ok(); - } - }; + let load_save = + |start: bool, mut lock: MutexGuard<'_, CtrlKbdLed>| -> Result<(), RogError> { + // If waking up + if !start { + info!("CtrlKbdLedTask reloading brightness and modes"); + lock.led_node + .set_brightness(lock.config.brightness.into()) + .map_err(|e| { + error!("CtrlKbdLedTask: {e}"); + e + })?; + lock.write_current_config_mode().map_err(|e| { + error!("CtrlKbdLedTask: {e}"); + e + })?; + } else if start { + Self::update_config(&mut lock).map_err(|e| { + error!("CtrlKbdLedTask: {e}"); + e + })?; + } + Ok(()) + }; let inner1 = self.0.clone(); let inner3 = self.0.clone(); @@ -235,14 +241,16 @@ impl CtrlTask for CtrlAuraZbus { let inner1 = inner1.clone(); async move { let lock = inner1.lock().await; - load_save(sleeping, lock); + load_save(sleeping, lock).unwrap(); // unwrap as we want to + // bomb out of the task } }, move |_shutting_down| { let inner3 = inner3.clone(); async move { let lock = inner3.lock().await; - load_save(false, lock); + load_save(false, lock).unwrap(); // unwrap as we want to + // bomb out of the task } }, move |_lid_closed| { @@ -266,7 +274,8 @@ impl CtrlTask for CtrlAuraZbus { .unwrap() .for_each(|_| async { if let Some(lock) = ctrl2.try_lock() { - load_save(true, lock); + load_save(true, lock).unwrap(); // unwrap as we want to + // bomb out of the task } }) .await; diff --git a/asusd/src/ctrl_platform.rs b/asusd/src/ctrl_platform.rs index 0184a8b6..6f0060f7 100644 --- a/asusd/src/ctrl_platform.rs +++ b/asusd/src/ctrl_platform.rs @@ -29,7 +29,7 @@ macro_rules! platform_get_value { $self.platform .get() .map_err(|err| { - warn!("RogPlatform: {}: {}", $prop_name, err); + warn!("{}: {}", $prop_name, err); FdoErr::Failed(format!("RogPlatform: {}: {}", $prop_name, err)) }) }) @@ -373,7 +373,7 @@ impl CtrlPlatform { #[zbus(property)] fn gpu_mux_mode(&self) -> Result { self.platform.get_gpu_mux_mode().map_err(|err| { - warn!("RogPlatform: set_gpu_mux_mode {err}"); + warn!("get_gpu_mux_mode {err}"); FdoErr::NotSupported("RogPlatform: set_gpu_mux_mode not supported".to_owned()) }) } @@ -382,7 +382,7 @@ impl CtrlPlatform { async fn set_gpu_mux_mode(&mut self, mode: u8) -> Result<(), FdoErr> { if self.platform.has_gpu_mux_mode() { self.set_gfx_mode(mode.into()).map_err(|err| { - warn!("RogPlatform: set_gpu_mux_mode {}", err); + warn!("set_gpu_mux_mode {}", err); FdoErr::Failed(format!("RogPlatform: set_gpu_mux_mode: {err}")) })?; self.config.lock().await.write(); @@ -412,7 +412,7 @@ impl CtrlPlatform { self.platform .set_throttle_thermal_policy(policy.into()) .map_err(|err| { - warn!("RogPlatform: throttle_thermal_policy {}", err); + warn!("throttle_thermal_policy {}", err); FdoErr::Failed(format!("RogPlatform: throttle_thermal_policy: {err}")) })?; Ok(self.throttle_thermal_policy_changed(&ctxt).await?) @@ -440,7 +440,7 @@ impl CtrlPlatform { self.platform .set_throttle_thermal_policy(policy.into()) .map_err(|err| { - warn!("RogPlatform: throttle_thermal_policy {}", err); + warn!("throttle_thermal_policy {}", err); FdoErr::Failed(format!("RogPlatform: throttle_thermal_policy: {err}")) }) } else { From 637360095cb976c0f312cfc8a13e96d062625692 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sat, 23 Mar 2024 23:27:26 +1300 Subject: [PATCH 08/11] Shift init actions up a few calls to prevent over-eager init --- asusd/src/ctrl_anime/mod.rs | 2 +- asusd/src/ctrl_aura/controller.rs | 4 +- asusd/src/ctrl_aura/manager.rs | 48 +++++++++---------- .../examples/ally-gamepad-calibration.rs | 2 +- .../examples/ally-gamepad-mode-changes.rs | 2 +- .../examples/ally-set-qam-secondary.rs | 2 +- rog-platform/src/hid_raw.rs | 34 +++++-------- 7 files changed, 43 insertions(+), 51 deletions(-) diff --git a/asusd/src/ctrl_anime/mod.rs b/asusd/src/ctrl_anime/mod.rs index 939d22a0..b846f4f9 100644 --- a/asusd/src/ctrl_anime/mod.rs +++ b/asusd/src/ctrl_anime/mod.rs @@ -68,7 +68,7 @@ impl CtrlAnime { let node = if usb.is_some() { unsafe { Node::Usb(usb.unwrap_unchecked()) } } else if hid.is_some() { - unsafe { Node::Hid(hid.unwrap_unchecked().0) } + unsafe { Node::Hid(hid.unwrap_unchecked()) } } else { return Err(RogError::Anime(AnimeError::NoDevice)); }; diff --git a/asusd/src/ctrl_aura/controller.rs b/asusd/src/ctrl_aura/controller.rs index 37283ab0..463ff9ad 100644 --- a/asusd/src/ctrl_aura/controller.rs +++ b/asusd/src/ctrl_aura/controller.rs @@ -366,7 +366,7 @@ mod tests { }; let mut controller = CtrlKbdLed { led_prod: AuraDevice::X19b6, - led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap().0), + led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap()), supported_data: supported_basic_modes, per_key_mode_active: false, config, @@ -404,7 +404,7 @@ mod tests { }; let mut controller = CtrlKbdLed { led_prod: AuraDevice::X19b6, - led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap().0), + led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("id_product").unwrap()), supported_data: supported_basic_modes, per_key_mode_active: false, config, diff --git a/asusd/src/ctrl_aura/manager.rs b/asusd/src/ctrl_aura/manager.rs index 6a518ba3..5c56a18a 100644 --- a/asusd/src/ctrl_aura/manager.rs +++ b/asusd/src/ctrl_aura/manager.rs @@ -85,13 +85,13 @@ impl AuraManager { }; if action == "remove" { - dbg!("REMOVING"); if let Some(_) = parent.attribute_value("idProduct") { info!("AuraManager removing: {path:?}"); let conn_copy = conn_copy.clone(); let interfaces_copy = interfaces.clone(); tokio::spawn(async move { - let mut interfaces = interfaces_copy.lock().await; + let mut interfaces = interfaces_copy.lock().await; // hold until completed + interfaces.remove(&path); let res = conn_copy .object_server() .remove::(&path) @@ -101,13 +101,11 @@ impl AuraManager { e })?; info!("AuraManager removed: {path:?}, {res}"); - interfaces.remove(&path); debug!("Removed {path:?}"); Ok::<(), RogError>(()) }); } } else if action == "add" { - dbg!("ADDING"); let id_product = if let Some(id_product) = parent.attribute_value("idProduct") { id_product.to_string_lossy().to_string() @@ -135,7 +133,7 @@ impl AuraManager { }; let dev_node = if let Some(dev_node) = event.devnode() { - dev_node + dev_node.to_owned() } else { continue; }; @@ -145,21 +143,23 @@ impl AuraManager { { // bah... shitty clone TODO: fix let data_clone = data.clone(); - if let Ok(mut ctrl) = - CtrlKbdLed::from_hidraw(raw, path.clone(), &data) - { - info!( - "AuraManager found device at: {dev_node:?}, {path:?}" - ); - let mut conn_copy = conn_copy.clone(); - let interfaces_copy = interfaces.clone(); - // - tokio::spawn(async move { - let mut interfaces = interfaces_copy.lock().await; - if interfaces.contains(&path) { - debug!("Already a ctrl at {path:?}"); - return Ok(()); - } + let mut conn_copy = conn_copy.clone(); + let interfaces_copy = interfaces.clone(); + // + tokio::spawn(async move { + let mut interfaces = interfaces_copy.lock().await; + if interfaces.contains(&path) { + debug!("Already a ctrl at {path:?}"); + return Ok(()); + } + if let Ok(mut ctrl) = + CtrlKbdLed::from_hidraw(raw, path.clone(), &data_clone) + { + info!( + "AuraManager found device at: {dev_node:?}, \ + {path:?}" + ); + debug!("Starting Aura at {path}"); interfaces.insert(path.clone()); let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; @@ -170,10 +170,10 @@ impl AuraManager { let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; start_tasks(zbus, &mut conn_copy, sig_ctx, &path) .await?; - Ok::<(), RogError>(()) - }); // Can't get result from here due to - // MonitorSocket - } + } + Ok::<(), RogError>(()) + }); // Can't get result from here due to + // MonitorSocket } } else { warn!("idProduct:{id_product:?} is unknown, not using") diff --git a/rog-platform/examples/ally-gamepad-calibration.rs b/rog-platform/examples/ally-gamepad-calibration.rs index 89d4e196..c70ed9f2 100644 --- a/rog-platform/examples/ally-gamepad-calibration.rs +++ b/rog-platform/examples/ally-gamepad-calibration.rs @@ -24,7 +24,7 @@ pub fn main() -> Result<(), Box> { return Err("RogError::NoAuraKeyboard".into()); } - let node = usb_node.unwrap().0; + let node = usb_node.unwrap(); let mut packet: [u8; 64] = [ 0x5a, 0xd1, 0x0d, 0x0e, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/rog-platform/examples/ally-gamepad-mode-changes.rs b/rog-platform/examples/ally-gamepad-mode-changes.rs index 5e84d67c..112e71b5 100644 --- a/rog-platform/examples/ally-gamepad-mode-changes.rs +++ b/rog-platform/examples/ally-gamepad-mode-changes.rs @@ -26,7 +26,7 @@ pub fn main() -> Result<(), Box> { return Err("RogError::NoAuraKeyboard".into()); } - let node = usb_node.unwrap().0; + let node = usb_node.unwrap(); // node.write_bytes(&[0x5a, 0xd1, 0x0a, 0x01])?; // TODO: need to CHECK println!("Set mouse mode for 10 seconds"); diff --git a/rog-platform/examples/ally-set-qam-secondary.rs b/rog-platform/examples/ally-set-qam-secondary.rs index dcc7121b..c3365ea8 100644 --- a/rog-platform/examples/ally-set-qam-secondary.rs +++ b/rog-platform/examples/ally-set-qam-secondary.rs @@ -24,7 +24,7 @@ pub fn main() -> Result<(), Box> { return Err("RogError::NoAuraKeyboard".into()); } - let node = usb_node.unwrap().0; + let node = usb_node.unwrap(); // node.write_bytes(&[0x5a, 0xd1, 0x0a, 0x01])?; // TODO: need to CHECK println!("Set mouse mode for 10 seconds"); diff --git a/rog-platform/src/hid_raw.rs b/rog-platform/src/hid_raw.rs index 8218a051..f4772060 100644 --- a/rog-platform/src/hid_raw.rs +++ b/rog-platform/src/hid_raw.rs @@ -22,7 +22,7 @@ pub struct HidRaw { } impl HidRaw { - pub fn new(id_product: &str) -> Result<(Self, Device)> { + pub fn new(id_product: &str) -> Result { let mut enumerator = udev::Enumerator::new().map_err(|err| { warn!("{}", err); PlatformError::Udev("enumerator failed".into(), err) @@ -47,17 +47,12 @@ impl HidRaw { if parent_id == id_product { if let Some(dev_node) = endpoint.devnode() { info!("Using device at: {:?} for hidraw control", dev_node); - return Ok(( - Self { - file: RefCell::new( - OpenOptions::new().write(true).open(dev_node)?, - ), - devfs_path: dev_node.to_owned(), - prod_id: id_product.to_string(), - syspath: endpoint.syspath().into(), - }, - usb_device, - )); + return Ok(Self { + file: RefCell::new(OpenOptions::new().write(true).open(dev_node)?), + devfs_path: dev_node.to_owned(), + prod_id: id_product.to_string(), + syspath: endpoint.syspath().into(), + }); } } } @@ -70,15 +65,12 @@ impl HidRaw { "Using device at: {:?} for control", dev_node ); - return Ok(( - Self { - file: RefCell::new(OpenOptions::new().write(true).open(dev_node)?), - devfs_path: dev_node.to_owned(), - prod_id: id_product.to_string(), - syspath: endpoint.syspath().into(), - }, - endpoint, - )); + return Ok(Self { + file: RefCell::new(OpenOptions::new().write(true).open(dev_node)?), + devfs_path: dev_node.to_owned(), + prod_id: id_product.to_string(), + syspath: endpoint.syspath().into(), + }); } } } From 739a0ffa63696731a27912b20adba7c814f97185 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sun, 24 Mar 2024 10:55:20 +1300 Subject: [PATCH 09/11] aura debugging --- asusd/src/ctrl_aura/manager.rs | 152 ++++++++++++++++++--------------- 1 file changed, 82 insertions(+), 70 deletions(-) diff --git a/asusd/src/ctrl_aura/manager.rs b/asusd/src/ctrl_aura/manager.rs index 5c56a18a..c9fe6f48 100644 --- a/asusd/src/ctrl_aura/manager.rs +++ b/asusd/src/ctrl_aura/manager.rs @@ -54,6 +54,7 @@ impl AuraManager { // detect all plugged in aura devices (eventually) let interfaces = Arc::new(Mutex::new(interfaces)); + let mut count = 0; tokio::spawn(async move { let mut monitor = MonitorBuilder::new()?.match_subsystem("hidraw")?.listen()?; let mut poll = Poll::new()?; @@ -65,10 +66,20 @@ impl AuraManager { if poll.poll(&mut events, None).is_err() { continue; } + // collect and sort so remove events are first + // let mut events: Vec = monitor.iter().filter(|e| + // &*e.action().unwrap_or_default() == "remove").collect(); + // let mut adds: Vec = monitor.iter().filter(|e| + // &*e.action().unwrap_or_default() == "add").collect(); + // events.append(&mut adds); + + dbg!("LOOPED", count); + count += 1; for event in monitor.iter() { if event.parent_with_subsystem("hidraw").is_err() { continue; } + if let Some(parent) = event.parent_with_subsystem_devtype("usb", "usb_device")? { @@ -78,20 +89,33 @@ impl AuraManager { continue; }; + let id_product = + if let Some(id_product) = parent.attribute_value("idProduct") { + id_product.to_string_lossy() + } else { + continue; + }; + let aura_device = AuraDevice::from(&*id_product); + if aura_device == AuraDevice::Unknown { + warn!("idProduct:{id_product:?} is unknown, not using"); + continue; + } + let path = if let Some(path) = dbus_path_for_dev(&parent) { path } else { continue; }; + dbg!(action, &aura_device, &path); if action == "remove" { - if let Some(_) = parent.attribute_value("idProduct") { - info!("AuraManager removing: {path:?}"); - let conn_copy = conn_copy.clone(); - let interfaces_copy = interfaces.clone(); - tokio::spawn(async move { - let mut interfaces = interfaces_copy.lock().await; // hold until completed - interfaces.remove(&path); + info!("AuraManager removing: {path:?}"); + let conn_copy = conn_copy.clone(); + let interfaces_copy = interfaces.clone(); + tokio::spawn(async move { + let mut interfaces = interfaces_copy.lock().await; // hold until completed + dbg!(&interfaces); + if interfaces.remove(&path) { let res = conn_copy .object_server() .remove::(&path) @@ -101,21 +125,16 @@ impl AuraManager { e })?; info!("AuraManager removed: {path:?}, {res}"); - debug!("Removed {path:?}"); - Ok::<(), RogError>(()) - }); - } + } + dbg!(&interfaces); + Ok::<(), RogError>(()) + }); } else if action == "add" { - let id_product = - if let Some(id_product) = parent.attribute_value("idProduct") { - id_product.to_string_lossy().to_string() - } else { - continue; - }; if let Some(p2) = event.parent() { if let Some(driver) = p2.driver() { // There is a tree of devices added so filter by driver if driver != "asus" { + debug!("{id_product:?} driver was not asus, skipping"); continue; } } else { @@ -123,60 +142,53 @@ impl AuraManager { } } - // try conversion to known idProduct - let aura_device = AuraDevice::from(id_product.as_str()); - if aura_device != AuraDevice::Unknown { - let path = if let Some(path) = dbus_path_for_dev(&parent) { - path - } else { - continue; - }; - - let dev_node = if let Some(dev_node) = event.devnode() { - dev_node.to_owned() - } else { - continue; - }; - - if let Ok(raw) = HidRaw::from_device(event.device()) - .map_err(|e| error!("device path error: {e:?}")) - { - // bah... shitty clone TODO: fix - let data_clone = data.clone(); - let mut conn_copy = conn_copy.clone(); - let interfaces_copy = interfaces.clone(); - // - tokio::spawn(async move { - let mut interfaces = interfaces_copy.lock().await; - if interfaces.contains(&path) { - debug!("Already a ctrl at {path:?}"); - return Ok(()); - } - if let Ok(mut ctrl) = - CtrlKbdLed::from_hidraw(raw, path.clone(), &data_clone) - { - info!( - "AuraManager found device at: {dev_node:?}, \ - {path:?}" - ); - - debug!("Starting Aura at {path}"); - interfaces.insert(path.clone()); - let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; - ctrl.config = - CtrlKbdLed::init_config(aura_device, &data_clone); - let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); - // Now add it to device list - let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; - start_tasks(zbus, &mut conn_copy, sig_ctx, &path) - .await?; - } - Ok::<(), RogError>(()) - }); // Can't get result from here due to - // MonitorSocket - } + let path = if let Some(path) = dbus_path_for_dev(&parent) { + path } else { - warn!("idProduct:{id_product:?} is unknown, not using") + continue; + }; + + let dev_node = if let Some(dev_node) = event.devnode() { + dev_node.to_owned() + } else { + continue; + }; + + if let Ok(raw) = HidRaw::from_device(event.device()) + .map_err(|e| error!("device path error: {e:?}")) + { + // bah... shitty clone TODO: fix + let data_clone = data.clone(); + let mut conn_copy = conn_copy.clone(); + let interfaces_copy = interfaces.clone(); + // + tokio::spawn(async move { + let mut interfaces = interfaces_copy.lock().await; + dbg!(&interfaces); + if interfaces.contains(&path) { + debug!("Already a ctrl at {path:?}"); + return Ok(()); + } + if let Ok(mut ctrl) = + CtrlKbdLed::from_hidraw(raw, path.clone(), &data_clone) + { + info!( + "AuraManager found device at: {dev_node:?}, {path:?}" + ); + debug!("Starting Aura at {path}"); + interfaces.insert(path.clone()); + let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; + ctrl.config = + CtrlKbdLed::init_config(aura_device, &data_clone); + let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); + // Now add it to device list + let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; + start_tasks(zbus, &mut conn_copy, sig_ctx, &path).await?; + } + dbg!(&interfaces); + Ok::<(), RogError>(()) + }); // Can't get result from here due to + // MonitorSocket } } } From 7eae7c5664d57adfdcec4248947c102da85409a9 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Sun, 24 Mar 2024 21:14:54 +1300 Subject: [PATCH 10/11] Change aura manager task to blocking. Remove idle tasks that keep hanging --- Cargo.toml | 4 +- asusd/Cargo.toml | 1 + asusd/src/ctrl_aura/manager.rs | 220 ++++++++++++++------------------- asusd/src/daemon.rs | 1 + 4 files changed, 96 insertions(+), 130 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c25d3efc..3d7509a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,11 +28,11 @@ version = "6.0.0-alpha1" rust-version = "1.76" [workspace.dependencies] -tokio = { version = "^1.23.0", default-features = false, features = [ +tokio = { version = "^1.36.0", default-features = false, features = [ "macros", "sync", "time", - "rt", + "rt-multi-thread", ] } concat-idents = "^1.1" dirs = "^4.0" diff --git a/asusd/Cargo.toml b/asusd/Cargo.toml index 2e5abfba..2f774baf 100644 --- a/asusd/Cargo.toml +++ b/asusd/Cargo.toml @@ -26,6 +26,7 @@ inotify.workspace = true mio.workspace = true tokio.workspace = true +# console-subscriber = "0.2.0" # cli and logging log.workspace = true diff --git a/asusd/src/ctrl_aura/manager.rs b/asusd/src/ctrl_aura/manager.rs index c9fe6f48..c164e29c 100644 --- a/asusd/src/ctrl_aura/manager.rs +++ b/asusd/src/ctrl_aura/manager.rs @@ -5,14 +5,14 @@ // - If udev sees device removed then remove the zbus path use std::collections::HashSet; -use std::sync::Arc; +use std::time::Duration; use log::{debug, error, info, warn}; use mio::{Events, Interest, Poll, Token}; use rog_aura::aura_detection::LaptopLedData; use rog_aura::usb::AuraDevice; use rog_platform::hid_raw::HidRaw; -use tokio::sync::Mutex; +use tokio::task::spawn_blocking; use udev::{Device, MonitorBuilder}; // use zbus::fdo::ObjectManager; use zbus::object_server::SignalContext; @@ -29,7 +29,7 @@ pub struct AuraManager { } impl AuraManager { - pub async fn new(mut connection: Connection) -> Result { + pub async fn new(connection: Connection) -> Result { let conn_copy = connection.clone(); let data = LaptopLedData::get_data(); let mut interfaces = HashSet::new(); @@ -42,20 +42,15 @@ impl AuraManager { let sig_ctx = CtrlAuraZbus::signal_context(&connection)?; let sig_ctx2 = sig_ctx.clone(); let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); - start_tasks(zbus, &mut connection, sig_ctx2, &path).await?; + start_tasks(zbus, connection.clone(), sig_ctx2, path).await?; } - // connection.object_server().at("/org/asuslinux", - // ObjectManager).await.unwrap(); - let manager = Self { _connection: connection, }; // detect all plugged in aura devices (eventually) - let interfaces = Arc::new(Mutex::new(interfaces)); - let mut count = 0; - tokio::spawn(async move { + spawn_blocking(move || { let mut monitor = MonitorBuilder::new()?.match_subsystem("hidraw")?.listen()?; let mut poll = Poll::new()?; let mut events = Events::with_capacity(1024); @@ -66,135 +61,107 @@ impl AuraManager { if poll.poll(&mut events, None).is_err() { continue; } - // collect and sort so remove events are first - // let mut events: Vec = monitor.iter().filter(|e| - // &*e.action().unwrap_or_default() == "remove").collect(); - // let mut adds: Vec = monitor.iter().filter(|e| - // &*e.action().unwrap_or_default() == "add").collect(); - // events.append(&mut adds); - - dbg!("LOOPED", count); - count += 1; for event in monitor.iter() { if event.parent_with_subsystem("hidraw").is_err() { continue; } - if let Some(parent) = + let parent = if let Some(parent) = event.parent_with_subsystem_devtype("usb", "usb_device")? { - let action = if let Some(action) = event.action() { - action - } else { - continue; - }; + parent + } else { + continue; + }; - let id_product = - if let Some(id_product) = parent.attribute_value("idProduct") { - id_product.to_string_lossy() - } else { - continue; - }; - let aura_device = AuraDevice::from(&*id_product); - if aura_device == AuraDevice::Unknown { - warn!("idProduct:{id_product:?} is unknown, not using"); + let action = if let Some(action) = event.action() { + action + } else { + continue; + }; + + let id_product = if let Some(id_product) = parent.attribute_value("idProduct") { + id_product.to_string_lossy() + } else { + continue; + }; + + let path = if let Some(path) = dbus_path_for_dev(&parent) { + path + } else { + continue; + }; + + let aura_device = AuraDevice::from(&*id_product); + if aura_device == AuraDevice::Unknown { + warn!("idProduct:{id_product:?} is unknown, not using"); + continue; + } + + if action == "remove" { + if interfaces.remove(&path) { + info!("AuraManager removing: {path:?}"); + let conn_copy = conn_copy.clone(); + tokio::spawn(async move { + let res = conn_copy + .object_server() + .remove::(&path) + .await + .map_err(|e| { + error!("Failed to remove {path:?}, {e:?}"); + e + })?; + info!("AuraManager removed: {path:?}, {res}"); + Ok::<(), RogError>(()) + }); + } + } else if action == "add" { + if interfaces.contains(&path) { + debug!("Already a ctrl at {path:?}"); continue; } - let path = if let Some(path) = dbus_path_for_dev(&parent) { - path - } else { - continue; - }; - - dbg!(action, &aura_device, &path); - if action == "remove" { - info!("AuraManager removing: {path:?}"); - let conn_copy = conn_copy.clone(); - let interfaces_copy = interfaces.clone(); - tokio::spawn(async move { - let mut interfaces = interfaces_copy.lock().await; // hold until completed - dbg!(&interfaces); - if interfaces.remove(&path) { - let res = conn_copy - .object_server() - .remove::(&path) - .await - .map_err(|e| { - error!("Failed to remove {path:?}, {e:?}"); - e - })?; - info!("AuraManager removed: {path:?}, {res}"); - } - dbg!(&interfaces); - Ok::<(), RogError>(()) - }); - } else if action == "add" { - if let Some(p2) = event.parent() { - if let Some(driver) = p2.driver() { - // There is a tree of devices added so filter by driver - if driver != "asus" { - debug!("{id_product:?} driver was not asus, skipping"); - continue; - } - } else { + // Need to check the driver is asus to prevent using hid_generic + if let Some(p2) = event.parent() { + if let Some(driver) = p2.driver() { + // There is a tree of devices added so filter by driver + if driver != "asus" { + debug!("{id_product:?} driver was not asus, skipping"); continue; } + } else { + continue; } + } - let path = if let Some(path) = dbus_path_for_dev(&parent) { - path - } else { - continue; - }; - - let dev_node = if let Some(dev_node) = event.devnode() { - dev_node.to_owned() - } else { - continue; - }; - + if let Some(dev_node) = event.devnode() { if let Ok(raw) = HidRaw::from_device(event.device()) .map_err(|e| error!("device path error: {e:?}")) { - // bah... shitty clone TODO: fix - let data_clone = data.clone(); - let mut conn_copy = conn_copy.clone(); - let interfaces_copy = interfaces.clone(); - // - tokio::spawn(async move { - let mut interfaces = interfaces_copy.lock().await; - dbg!(&interfaces); - if interfaces.contains(&path) { - debug!("Already a ctrl at {path:?}"); - return Ok(()); - } - if let Ok(mut ctrl) = - CtrlKbdLed::from_hidraw(raw, path.clone(), &data_clone) - { - info!( - "AuraManager found device at: {dev_node:?}, {path:?}" - ); - debug!("Starting Aura at {path}"); - interfaces.insert(path.clone()); - let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; - ctrl.config = - CtrlKbdLed::init_config(aura_device, &data_clone); - let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); - // Now add it to device list - let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; - start_tasks(zbus, &mut conn_copy, sig_ctx, &path).await?; - } - dbg!(&interfaces); - Ok::<(), RogError>(()) - }); // Can't get result from here due to - // MonitorSocket + if let Ok(mut ctrl) = + CtrlKbdLed::from_hidraw(raw, path.clone(), &data) + { + ctrl.config = CtrlKbdLed::init_config(aura_device, &data); + interfaces.insert(path.clone()); + info!("AuraManager starting device at: {dev_node:?}, {path:?}"); + let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; + let zbus = CtrlAuraZbus::new(ctrl, sig_ctx); + let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; + let conn_copy = conn_copy.clone(); + tokio::spawn(async move { + return tokio::time::timeout( + Duration::from_millis(1000), + start_tasks(zbus, conn_copy.clone(), sig_ctx, path), + ) + .await; + }); + } } } - } + }; } } - // Required for return type on tokio::spawn + // Required for return type on spawn #[allow(unreachable_code)] Ok::<(), RogError>(()) }); @@ -223,20 +190,17 @@ pub(crate) fn dbus_path_for_dev(parent: &Device) -> Option { async fn start_tasks( mut zbus: CtrlAuraZbus, - connection: &mut Connection, - signal_ctx: SignalContext<'static>, - path: &ObjectPath<'static>, + connection: Connection, + _signal_ctx: SignalContext<'static>, + path: OwnedObjectPath, ) -> Result<(), RogError> { - let task = zbus.clone(); + // let task = zbus.clone(); + // let signal_ctx = signal_ctx.clone(); zbus.reload() .await .unwrap_or_else(|err| warn!("Controller error: {}", err)); - - connection - .object_server() - .at(&ObjectPath::from_str_unchecked(path), zbus) - .await - .unwrap(); - task.create_tasks(signal_ctx).await.ok(); + connection.object_server().at(path, zbus).await.unwrap(); + // TODO: skip this until we keep handles to tasks so they can be killed + // task.create_tasks(signal_ctx).await Ok(()) } diff --git a/asusd/src/daemon.rs b/asusd/src/daemon.rs index e6d09984..b9d68cd1 100644 --- a/asusd/src/daemon.rs +++ b/asusd/src/daemon.rs @@ -18,6 +18,7 @@ use zbus::fdo::ObjectManager; #[tokio::main] async fn main() -> Result<(), Box> { + // console_subscriber::init(); let mut logger = env_logger::Builder::new(); logger .parse_default_env() From 4ba44560a9a6ccfd3b9a78a8f3625d60eaa7a91b Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Wed, 27 Mar 2024 19:27:22 +1300 Subject: [PATCH 11/11] Update deps --- Cargo.lock | 235 +++++++++++++++++++-------------- asusd/src/ctrl_aura/manager.rs | 10 +- rog-control-center/Cargo.toml | 10 +- 3 files changed, 139 insertions(+), 116 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ff4a4df8..847228f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -243,7 +243,7 @@ dependencies = [ "async-lock 3.3.0", "async-task", "concurrent-queue", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-lite 2.3.0", "slab", ] @@ -303,7 +303,7 @@ dependencies = [ "futures-io", "futures-lite 2.3.0", "parking", - "polling 3.5.0", + "polling 3.6.0", "rustix 0.38.32", "slab", "tracing", @@ -384,7 +384,7 @@ checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -413,13 +413,13 @@ checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" [[package]] name = "async-trait" -version = "0.1.78" +version = "0.1.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" +checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -437,14 +437,14 @@ dependencies = [ "derive_utils", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "az" @@ -454,9 +454,9 @@ checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -511,7 +511,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.53", + "syn 2.0.55", "which", ] @@ -579,7 +579,7 @@ dependencies = [ "async-channel 2.2.0", "async-lock 3.3.0", "async-task", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", "futures-lite 2.3.0", "piper", @@ -594,9 +594,9 @@ checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" [[package]] name = "by_address" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf8dba2868114ed769a1f2590fc9ae5eb331175b44313b6c9b922f8f7ca813d0" +checksum = "e7e9330396d4065c0788ac665e5ba4857c4744f5ff4239b6f06493aca55e0e08" [[package]] name = "bytemuck" @@ -615,7 +615,7 @@ checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -626,9 +626,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "calloop" @@ -638,7 +638,7 @@ checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" dependencies = [ "bitflags 2.5.0", "log", - "polling 3.5.0", + "polling 3.6.0", "rustix 0.38.32", "slab", "thiserror", @@ -824,7 +824,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f76990911f2267d837d9d0ad060aa63aaad170af40904b29461734c339030d4d" dependencies = [ "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -852,7 +852,7 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.5" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "const-field-offset-macro", "field-offset", @@ -861,11 +861,11 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.5" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1031,7 +1031,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1087,7 +1087,7 @@ checksum = "61bb5a1014ce6dfc2a378578509abe775a5aa06bff584a547555d9efdb81b926" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1275,7 +1275,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1402,9 +1402,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fdeflate" @@ -1443,7 +1443,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" dependencies = [ - "memoffset 0.9.0", + "memoffset 0.9.1", "rustc_version", ] @@ -1553,7 +1553,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1604,7 +1604,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-core", "futures-io", "parking", @@ -1929,7 +1929,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "i-slint-backend-linuxkms" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "calloop", "drm", @@ -1949,7 +1949,7 @@ dependencies = [ [[package]] name = "i-slint-backend-qt" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "const-field-offset", "i-slint-common", @@ -1961,7 +1961,7 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -1974,7 +1974,7 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "bytemuck", "cfg-if", @@ -2007,7 +2007,7 @@ dependencies = [ [[package]] name = "i-slint-common" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "cfg-if", "derive_more", @@ -2018,7 +2018,7 @@ dependencies = [ [[package]] name = "i-slint-compiler" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "by_address", "codemap", @@ -2047,7 +2047,7 @@ dependencies = [ [[package]] name = "i-slint-core" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "auto_enums", "bytemuck", @@ -2071,6 +2071,7 @@ dependencies = [ "pin-project", "pin-weak", "portable-atomic", + "raw-window-handle 0.6.0", "resvg", "rgb", "rustybuzz 0.13.0", @@ -2091,16 +2092,16 @@ dependencies = [ [[package]] name = "i-slint-core-macros" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] name = "i-slint-renderer-femtovg" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "cfg-if", "const-field-offset", @@ -2131,7 +2132,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "bytemuck", "cfg-if", @@ -2158,7 +2159,7 @@ dependencies = [ "softbuffer", "unicode-segmentation", "vtable", - "windows 0.52.0", + "windows 0.54.0", ] [[package]] @@ -2237,9 +2238,9 @@ checksum = "44feda355f4159a7c757171a77de25daf6411e217b4cabd03bd6650690468126" [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown", @@ -2347,9 +2348,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jni" @@ -2714,9 +2715,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] @@ -2842,7 +2843,7 @@ dependencies = [ "bitflags 2.5.0", "cfg-if", "libc", - "memoffset 0.9.0", + "memoffset 0.9.1", ] [[package]] @@ -2910,7 +2911,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3085,7 +3086,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3113,7 +3114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" dependencies = [ "atomic-waker", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", ] @@ -3170,12 +3171,13 @@ dependencies = [ [[package]] name = "polling" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" +checksum = "e0c976a60b2d7e99d6f229e414670a9b85d13ac305cc6d1e9c134de58c5aaaf6" dependencies = [ "cfg-if", "concurrent-queue", + "hermit-abi", "pin-project-lite", "rustix 0.38.32", "tracing", @@ -3205,12 +3207,12 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "prettyplease" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" dependencies = [ "proc-macro2", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3321,9 +3323,9 @@ checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" [[package]] name = "rayon" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -3370,9 +3372,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -3393,9 +3395,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "resvg" @@ -3565,7 +3567,7 @@ checksum = "32a58fa8a7ccff2aec4f39cc45bf5f985cec7125ab271cf681c279fd00192b49" dependencies = [ "countme", "hashbrown", - "memoffset 0.9.0", + "memoffset 0.9.1", "rustc-hash", "text-size", ] @@ -3764,14 +3766,14 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "itoa", "ryu", @@ -3786,7 +3788,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3847,9 +3849,9 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "skia-bindings" -version = "0.71.0" +version = "0.72.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e66af11d51ceb6a2b4d71fc195bfbf6f647259dd2459cf40c59d2ea5905c85db" +checksum = "ace7c5359ccb009880e65958eaf1e2fa68ee19ada6931300c2f1942f84abf2c3" dependencies = [ "bindgen", "cc", @@ -3864,14 +3866,14 @@ dependencies = [ [[package]] name = "skia-safe" -version = "0.71.0" +version = "0.72.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f16277b362e6c6374ac9bb2d4fd561f5f58b80a1729989d5d79b33ccc92ced" +checksum = "f0a4a3df502b317456a34df181ac67a7a6443b0f2e4b883ac220dba1dcb3ce38" dependencies = [ "bitflags 2.5.0", "lazy_static", "skia-bindings", - "windows 0.52.0", + "windows 0.54.0", ] [[package]] @@ -3886,7 +3888,7 @@ dependencies = [ [[package]] name = "slint" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -3902,18 +3904,18 @@ dependencies = [ [[package]] name = "slint-build" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "i-slint-compiler", "spin_on", "thiserror", - "toml_edit 0.22.8", + "toml_edit 0.22.9", ] [[package]] name = "slint-macros" version = "1.5.1" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -3932,9 +3934,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smithay-client-toolkit" @@ -4029,7 +4031,7 @@ dependencies = [ "cfg_aliases 0.1.1", "cocoa", "core-graphics", - "fastrand 2.0.1", + "fastrand 2.0.2", "foreign-types", "js-sys", "log", @@ -4106,13 +4108,13 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] name = "supergfxctl" version = "5.2.2" -source = "git+https://gitlab.com/asus-linux/supergfxctl.git#f3465681ac147821bbd2d50aff2bced2d92d529e" +source = "git+https://gitlab.com/asus-linux/supergfxctl.git#68c12374d2cc20e5503b7694168afa2bf52af705" dependencies = [ "log", "logind-zbus", @@ -4147,9 +4149,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.53" +version = "2.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" dependencies = [ "proc-macro2", "quote", @@ -4189,9 +4191,9 @@ dependencies = [ [[package]] name = "temp-dir" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd16aa9ffe15fe021c6ee3766772132c6e98dfa395a167e16864f61a9cfb71d6" +checksum = "1f227968ec00f0e5322f9b8173c7a0cbcff6181a0a5b28e9892491c286277231" [[package]] name = "tempfile" @@ -4200,7 +4202,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", - "fastrand 2.0.1", + "fastrand 2.0.2", "rustix 0.38.32", "windows-sys 0.52.0", ] @@ -4237,7 +4239,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4356,7 +4358,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4377,7 +4379,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.8", + "toml_edit 0.22.9", ] [[package]] @@ -4413,9 +4415,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.8" +version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c12219811e0c1ba077867254e5ad62ee2c9c190b0d957110750ac0cda1ae96cd" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" dependencies = [ "indexmap", "serde", @@ -4443,7 +4445,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4486,7 +4488,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ecce25dea8aeaadc44909f4c1226d22d84512fccd07d22447ecbad176bc09545" dependencies = [ "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4519,7 +4521,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" dependencies = [ - "memoffset 0.9.0", + "memoffset 0.9.1", "tempfile", "winapi", ] @@ -4688,7 +4690,7 @@ dependencies = [ [[package]] name = "vtable" version = "0.2.0" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "const-field-offset", "portable-atomic", @@ -4699,11 +4701,11 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.2.0" -source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#692020898223a29efbb597e18864841c6eb45d77" +source = "git+https://github.com/flukejones/sixtyfps.git?branch=feat/color_hsv#d73de5db8ac10b0b46a1c28c85722902dcf70d30" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -4749,7 +4751,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", "wasm-bindgen-shared", ] @@ -4783,7 +4785,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5011,6 +5013,16 @@ dependencies = [ "windows-targets 0.52.4", ] +[[package]] +name = "windows" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9252e5725dbed82865af151df558e754e4a3c2c30818359eb17465f1346a1b49" +dependencies = [ + "windows-core 0.54.0", + "windows-targets 0.52.4", +] + [[package]] name = "windows-core" version = "0.51.1" @@ -5029,6 +5041,25 @@ dependencies = [ "windows-targets 0.52.4", ] +[[package]] +name = "windows-core" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12661b9c89351d684a50a8a643ce5f608e20243b9fb84687800163429f161d65" +dependencies = [ + "windows-result", + "windows-targets 0.52.4", +] + +[[package]] +name = "windows-result" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd19df78e5168dfb0aedc343d1d1b8d422ab2db6756d2dc3fef75035402a3f64" +dependencies = [ + "windows-targets 0.52.4", +] + [[package]] name = "windows-sys" version = "0.45.0" @@ -5587,7 +5618,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] diff --git a/asusd/src/ctrl_aura/manager.rs b/asusd/src/ctrl_aura/manager.rs index c164e29c..54130edf 100644 --- a/asusd/src/ctrl_aura/manager.rs +++ b/asusd/src/ctrl_aura/manager.rs @@ -62,10 +62,6 @@ impl AuraManager { continue; } for event in monitor.iter() { - if event.parent_with_subsystem("hidraw").is_err() { - continue; - } - let parent = if let Some(parent) = event.parent_with_subsystem_devtype("usb", "usb_device")? { @@ -149,11 +145,7 @@ impl AuraManager { let sig_ctx = CtrlAuraZbus::signal_context(&conn_copy)?; let conn_copy = conn_copy.clone(); tokio::spawn(async move { - return tokio::time::timeout( - Duration::from_millis(1000), - start_tasks(zbus, conn_copy.clone(), sig_ctx, path), - ) - .await; + start_tasks(zbus, conn_copy.clone(), sig_ctx, path).await }); } } diff --git a/rog-control-center/Cargo.toml b/rog-control-center/Cargo.toml index d3ae7f04..39cde191 100644 --- a/rog-control-center/Cargo.toml +++ b/rog-control-center/Cargo.toml @@ -46,14 +46,14 @@ versions.workspace = true nix = "^0.26.1" tempfile = "3.3.0" -i-slint-backend-selector = { git = "https://github.com/flukejones/sixtyfps.git", branch = "asusctl" } -i-slint-core = { git = "https://github.com/flukejones/sixtyfps.git", branch = "asusctl" } -i-slint-backend-winit = { git = "https://github.com/flukejones/sixtyfps.git", branch = "asusctl" } +i-slint-backend-selector = { git = "https://github.com/flukejones/sixtyfps.git", branch = "feat/color_hsv" } +i-slint-core = { git = "https://github.com/flukejones/sixtyfps.git", branch = "feat/color_hsv" } +i-slint-backend-winit = { git = "https://github.com/flukejones/sixtyfps.git", branch = "feat/color_hsv" } winit = "*" [dependencies.slint] git = "https://github.com/flukejones/sixtyfps.git" -branch = "asusctl" +branch = "feat/color_hsv" default-features = false features = [ "std", @@ -66,7 +66,7 @@ features = [ [build-dependencies.slint-build] git = "https://github.com/flukejones/sixtyfps.git" -branch = "asusctl" +branch = "feat/color_hsv" [dev-dependencies] cargo-husky.workspace = true