Compare commits

...

26 Commits

Author SHA1 Message Date
Luke D. Jones 9c7dfb4030 Small fixups 2024-05-11 11:09:02 +12:00
Luke D. Jones f855908c82 Better everything 2024-05-11 11:03:13 +12:00
Luke D. Jones 293a087b8a Fixups 2024-05-10 23:14:48 +12:00
Luke D. Jones fd72a04bb8 Sanitize the dbus path for aura devices (remove '.' chars) 2024-05-10 19:37:38 +12:00
Luke D. Jones f131a3fa70 More logigng. Adjust the aura init process. Fix TUF led power 2024-05-10 18:58:05 +12:00
Luke D. Jones ccf8d8df91 Prep 6.0.5 version 2024-05-10 12:44:46 +12:00
Luke D. Jones b970d364f7 Fix test 2024-05-10 12:36:34 +12:00
Luke D. Jones 1da68ea69d Try to mitigate the lack of kbd_brightness on some laptops 2024-05-10 12:22:36 +12:00
Luke D. Jones e62e7e8eca Cleanup sys config 2024-05-10 10:26:32 +12:00
Luke D. Jones 1b1d10c461 Try to better handle pre-2021 laptops with lightbar 2024-05-10 10:04:51 +12:00
Stefan Boca 14ea0f6d83 Update GA402XV supported aura modes 2024-05-08 19:20:17 -07:00
Luke Jones 5107a6c39c Merge branch 'FAYZER77-main-patch-34823' into 'main'
Change 733C model profile to add support for Lid LED, and remove unneeded basic zones entries

See merge request asus-linux/asusctl!183
2024-05-08 23:12:56 +00:00
FAYZER77 2c77ec9e24 Change 733C model profile to add support for Lid LED, and remove unneeded basic zones entries 2024-05-08 23:08:19 +00:00
Luke D. Jones 817a66bdf1 Prep 6.0.4 2024-05-09 11:00:51 +12:00
Luke D. Jones 664a3d5533 Match G533Q to 0x8166 keyboard ID explicitly
Should close #438
2024-05-09 10:01:48 +12:00
Luke D. Jones 37bc5e45b9 Fix: ensure property derive is on all property methods for slash 2024-05-09 09:34:02 +12:00
Luke D. Jones a18692ef1e Fix up colour sliders
- Fixup colour sliders for UI
- Correctly drop tokio runtime
2024-05-08 22:55:11 +12:00
Luke D. Jones 1b023d0f5f Fix and prep new 6.0.2 release 2024-05-08 16:27:40 +12:00
Luke D. Jones 74f74e73c4 Update deps, point release 2024-05-07 13:56:25 +12:00
Luke D. Jones 9c7df9ad39 Update deps, point release 2024-05-07 12:58:17 +12:00
Luke D. Jones 94adf5d24d Revert back to zbus 4.1 2024-05-06 23:54:36 +12:00
Luke D. Jones 8dbdb68175 Increase tray icon sleep time 2024-05-06 23:14:51 +12:00
Luke D. Jones 89002eb5ec Use fluent-dark instead of cosmic due to compile times 2024-05-06 23:01:03 +12:00
Luke D. Jones dc9ef8cf54 Remove unused deps 2024-05-06 13:25:07 +12:00
Luke D. Jones 667697d042 Cleanup deps 2024-05-06 10:58:11 +12:00
Luke D. Jones bc92fa11f9 Update all cargo.toml. Support G713P 2024-05-06 09:45:35 +12:00
56 changed files with 1163 additions and 1518 deletions
+63
View File
@@ -7,6 +7,69 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [v6.0.6]
### Added
- Add GX650R laptop to aura DB
### Changed
- Further tweaks to aura init
- More logging
- Fix TUF laptop led power
- Sanitize the dbus path for aura devices (remove `.` chars)
- Even more error handling (gracefully)
- Better checking for dbus interfaces
- Remove dbus `supported_interfaces`
- dbus ObjectManager is now at root `/`
## [v6.0.5]
### Changed
- Better more robust error handling in ROGCC
- Try to better handle pre-2021 laptops with lightbar
- Add more logging to try and trace the charge_control_end_threshold issue
- Make `kbd_brightness` optional to work around issues on some laptops that seem to lack it. Likely this will all need a refactor *again* if work proceeds in kernel for better RGB support.
## [v6.0.4]
### Changed
- Remove some `todo()` in rogcc
- Add missing `#[zbus(property)]` derive to Slash dbus properties
- Match G533Q laptop explicitly to the 0x8166 PID
## [v6.0.3]
### NOTE
- Xorg is not supported any longer. All major desktops and distros are Wayland.
### Changed
- Add a check to prevent non-TUF laptops with screwed up method return from TUF acpi methods from trying to add a TUF aura device without actually being a TUF laptop.
- Make the G834JZ entry in aura db generic for all G834J
## [v6.0.2]
### Changed
- Clean up code
- Don't panic if no aura device in ROGCC
- Try to prevent an errorenous tuf keyboard detection
## [v6.0.1]
### Added
- Support the G713P keyboard
### Changed
- Update all `Cargo.toml` to use workspace deps and remove unused features
- Update dependencies where possible
- Switch the UI to use fluent-dark instead of cosmic-dark due to extremely long compile time
## [v6.0.0] ## [v6.0.0]
### Important note ### Important note
Generated
+215 -734
View File
File diff suppressed because it is too large Load Diff
+18 -9
View File
@@ -1,3 +1,14 @@
[workspace.package]
version = "6.0.6"
rust-version = "1.77"
license = "MPL-2.0"
readme = "README.md"
authors = ["Luke <luke@ljones.dev>"]
repository = "https://gitlab.com/asus-linux/asusctl"
homepage = "https://gitlab.com/asus-linux/asusctl"
description = "Laptop feature control for ASUS ROG laptops and others"
edition = "2021"
[workspace] [workspace]
members = [ members = [
"asusctl", "asusctl",
@@ -24,10 +35,6 @@ default-members = [
] ]
resolver = "2" resolver = "2"
[workspace.package]
version = "6.0.0"
rust-version = "1.77"
[workspace.dependencies] [workspace.dependencies]
tokio = { version = "^1.36.0", default-features = false, features = [ tokio = { version = "^1.36.0", default-features = false, features = [
"macros", "macros",
@@ -40,13 +47,11 @@ dirs = "^4.0"
smol = "^1.3" smol = "^1.3"
mio = "0.8.11" mio = "0.8.11"
zbus = "~4.1.2" zbus = "4.1"
logind-zbus = { version = "~4.0.2" } #, default-features = false, features = ["non_blocking"] } logind-zbus = { version = "4.0.2" } #, default-features = false, features = ["non_blocking"] }
serde = "^1.0" serde = "^1.0"
serde_derive = "^1.0" serde_derive = "^1.0"
serde_json = "^1.0"
toml = "^0.5.10"
ron = "*" ron = "*"
typeshare = "1.0.0" typeshare = "1.0.0"
@@ -64,7 +69,7 @@ pix = "^0.13"
tinybmp = "^0.4.0" tinybmp = "^0.4.0"
gif = "^0.12.0" gif = "^0.12.0"
versions = "4.1" versions = "6.2"
notify-rust = { git = "https://github.com/flukejones/notify-rust.git", rev = "54176413b81189a3e4edbdc20a0b4f7e2e35c063", default-features = false, features = [ notify-rust = { git = "https://github.com/flukejones/notify-rust.git", rev = "54176413b81189a3e4edbdc20a0b4f7e2e35c063", default-features = false, features = [
"z", "z",
@@ -83,6 +88,10 @@ codegen-units = 1
opt-level = 1 opt-level = 1
codegen-units = 16 codegen-units = 16
[profile.dev.package."*"]
opt-level = 1
codegen-units = 16
[profile.bench] [profile.bench]
debug = false debug = false
opt-level = 3 opt-level = 3
+8 -5
View File
@@ -11,7 +11,9 @@ Now includes a GUI, `rog-control-center`.
## Kernel support ## Kernel support
**The minimum supported kernel version is 6.10**, which will contain the patches from [here](https://lore.kernel.org/platform-driver-x86/20240404001652.86207-1-luke@ljones.dev/). Z13 devices will need [these](https://lore.kernel.org/linux-input/20240416090402.31057-1-luke@ljones.dev/T/#t) **The minimum supported kernel version is 6.10**, which will contain the patches from [here](https://lore.kernel.org/platform-driver-x86/20240404001652.86207-1-luke@ljones.dev/). This is especially required for 2023+ devices and possibly some lat 2022 devices.
Z13 devices will need [these](https://lore.kernel.org/linux-input/20240416090402.31057-1-luke@ljones.dev/T/#t)
## Goals ## Goals
@@ -31,7 +33,7 @@ See the [rog-aura readme](./rog-aura/README.md) for more details.
## Discord ## Discord
[Discord server link](https://discord.gg/z8y99XqPb7) [![Discord](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/z8y99XqPb7)
## SUPPORTED LAPTOPS ## SUPPORTED LAPTOPS
@@ -70,14 +72,15 @@ The list is a bit outdated as many features have been enabled in the Linux kerne
A gui is now in the repo - ROG Control Center. At this time it is still a WIP, but it has almost all features in place already. A gui is now in the repo - ROG Control Center. At this time it is still a WIP, but it has almost all features in place already.
**NOTE**: Xorg is not supported.
# BUILDING # BUILDING
Rust and cargo are required, they can be installed from [rustup.rs](https://rustup.rs/) or from the distro repos if newer than 1.75. Rust and cargo are required, they can be installed from [rustup.rs](https://rustup.rs/) or from the distro repos if newer than 1.75.
**fedora:** **fedora:**
dnf install cmake clang-devel libinput-devel libseat-devel libgbm-devel libxkbcommon-devel systemd-devel \ dnf install cmake clang-devel libinput-devel libseat-devel libgbm-devel libxkbcommon-devel systemd-devel libdrm-devel expat-devel pcre2-devel libzstd-devel gtk3-devel
libdrm-devel expat-devel pcre2-devel libzstd-devel libappindicator-gtk3
make make
sudo make install sudo make install
@@ -86,7 +89,7 @@ Rust and cargo are required, they can be installed from [rustup.rs](https://rust
Works with KDE Plasma (without GTK packages) Works with KDE Plasma (without GTK packages)
zypper in -t pattern devel_basis zypper in -t pattern devel_basis
zypper in rustup make cmake libinput-devel libseat-devel libgbm-devel systemd-devel clang-devel llvm-devel gdk-pixbuf-devel cairo-devel pango-devel freetype-devel libexpat-devel libayatana-indicator3-7 zypper in rustup make cmake clang-devel libinput-devel libseat-devel libgbm-devel libxkbcommon-devel systemd-devel libdrm-devel expat-devel pcre2-devel libzstd-devel gtk3-devel
make make
sudo make install sudo make install
+8 -10
View File
@@ -1,9 +1,12 @@
[package] [package]
name = "asusctl" name = "asusctl"
license = "MPL-2.0" license.workspace = true
authors = ["Luke D Jones <luke@ljones.dev>"]
edition = "2021"
version.workspace = true version.workspace = true
readme.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
[dependencies] [dependencies]
rog_anime = { path = "../rog-anime" } rog_anime = { path = "../rog-anime" }
@@ -15,16 +18,11 @@ rog_platform = { path = "../rog-platform" }
asusd = { path = "../asusd" } asusd = { path = "../asusd" }
dmi_id = { path = "../dmi-id" } dmi_id = { path = "../dmi-id" }
ron.workspace = true
gumdrop.workspace = true gumdrop.workspace = true
toml.workspace = true
zbus.workspace = true zbus.workspace = true
tokio.workspace = true
[dev-dependencies] [dev-dependencies]
gif.workspace = true
tinybmp.workspace = true
glam.workspace = true
rog_dbus = { path = "../rog-dbus" } rog_dbus = { path = "../rog-dbus" }
tokio.workspace = true
cargo-husky.workspace = true cargo-husky.workspace = true
+1
View File
@@ -87,6 +87,7 @@ impl FromStr for LedBrightness {
} }
} }
} }
#[allow(clippy::to_string_trait_impl)]
impl ToString for LedBrightness { impl ToString for LedBrightness {
fn to_string(&self) -> String { fn to_string(&self) -> String {
let s = match self.level { let s = match self.level {
+52 -23
View File
@@ -14,6 +14,7 @@ use rog_anime::usb::get_anime_type;
use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2}; use rog_anime::{AnimTime, AnimeDataBuffer, AnimeDiagonal, AnimeGif, AnimeImage, AnimeType, Vec2};
use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower}; use rog_aura::keyboard::{AuraPowerState, LaptopAuraPower};
use rog_aura::{self, AuraDeviceType, AuraEffect, PowerZones}; use rog_aura::{self, AuraDeviceType, AuraEffect, PowerZones};
use rog_dbus::list_iface_blocking;
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use rog_dbus::zbus_aura::AuraProxyBlocking; use rog_dbus::zbus_aura::AuraProxyBlocking;
use rog_dbus::zbus_fan_curves::FanCurvesProxyBlocking; use rog_dbus::zbus_fan_curves::FanCurvesProxyBlocking;
@@ -22,6 +23,7 @@ use rog_dbus::zbus_slash::SlashProxyBlocking;
use rog_platform::platform::{GpuMode, Properties, ThrottlePolicy}; use rog_platform::platform::{GpuMode, Properties, ThrottlePolicy};
use rog_profiles::error::ProfileError; use rog_profiles::error::ProfileError;
use rog_slash::SlashMode; use rog_slash::SlashMode;
use ron::ser::PrettyConfig;
use zbus::blocking::Connection; use zbus::blocking::Connection;
use crate::aura_cli::{AuraPowerStates, LedBrightness}; use crate::aura_cli::{AuraPowerStates, LedBrightness};
@@ -64,7 +66,7 @@ fn main() {
} }
let supported_properties = platform_proxy.supported_properties().unwrap(); let supported_properties = platform_proxy.supported_properties().unwrap();
let supported_interfaces = platform_proxy.supported_interfaces().unwrap(); let supported_interfaces = list_iface_blocking().unwrap();
if parsed.version { if parsed.version {
println!("asusctl v{}", env!("CARGO_PKG_VERSION")); println!("asusctl v{}", env!("CARGO_PKG_VERSION"));
@@ -88,7 +90,10 @@ fn print_error_help(
print_info(); print_info();
println!(); println!();
println!("Supported interfaces:\n\n{:#?}\n", supported_interfaces); println!("Supported interfaces:\n\n{:#?}\n", supported_interfaces);
println!("Supported properties:\n\n{:#?}\n", supported_properties); println!(
"Supported properties on Platform:\n\n{:#?}\n",
supported_properties
);
} }
fn print_info() { fn print_info() {
@@ -119,12 +124,8 @@ fn check_service(name: &str) -> bool {
fn find_aura_iface() -> Result<Vec<AuraProxyBlocking<'static>>, Box<dyn std::error::Error>> { fn find_aura_iface() -> Result<Vec<AuraProxyBlocking<'static>>, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system().unwrap(); let conn = zbus::blocking::Connection::system().unwrap();
let f = zbus::blocking::fdo::ObjectManagerProxy::new( let f =
&conn, zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/").unwrap();
"org.asuslinux.Daemon",
"/org/asuslinux",
)
.unwrap();
let interfaces = f.get_managed_objects().unwrap(); let interfaces = f.get_managed_objects().unwrap();
let mut aura_paths = Vec::new(); let mut aura_paths = Vec::new();
for v in interfaces.iter() { for v in interfaces.iter() {
@@ -202,6 +203,31 @@ fn do_parsed(
}; };
let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect(); let commands: Vec<String> = cmdlist.lines().map(|s| s.to_owned()).collect();
for command in commands.iter().filter(|command| { for command in commands.iter().filter(|command| {
if command.trim().starts_with("fan-curve")
&& !supported_interfaces
.contains(&"org.asuslinux.FanCurves".to_string())
{
return false;
}
if command.trim().starts_with("anime")
&& !supported_interfaces.contains(&"org.asuslinux.Anime".to_string())
{
return false;
}
if command.trim().starts_with("slash")
&& !supported_interfaces.contains(&"org.asuslinux.Slash".to_string())
{
return false;
}
if command.trim().starts_with("bios")
&& !supported_interfaces.contains(&"org.asuslinux.Platform".to_string())
{
return false;
}
if !dev_type.is_old_laptop() if !dev_type.is_old_laptop()
&& !dev_type.is_tuf_laptop() && !dev_type.is_tuf_laptop()
&& command.trim().starts_with("led-pow-1") && command.trim().starts_with("led-pow-1")
@@ -644,25 +670,28 @@ fn handle_led_power_1_do_1866(
aura: &AuraProxyBlocking, aura: &AuraProxyBlocking,
power: &LedPowerCommand1, power: &LedPowerCommand1,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
let zone = if power.keyboard && power.lightbar { let mut states = Vec::new();
PowerZones::KeyboardAndLightbar if power.keyboard {
} else if power.lightbar { states.push(AuraPowerState {
PowerZones::Lightbar zone: PowerZones::Keyboard,
} else {
PowerZones::Keyboard
};
let states = LaptopAuraPower {
states: vec![AuraPowerState {
zone,
boot: power.boot.unwrap_or_default(), boot: power.boot.unwrap_or_default(),
awake: power.awake.unwrap_or_default(), awake: power.awake.unwrap_or_default(),
sleep: power.sleep.unwrap_or_default(), sleep: power.sleep.unwrap_or_default(),
shutdown: false, shutdown: false,
}], });
}; }
if power.lightbar {
states.push(AuraPowerState {
zone: PowerZones::Lightbar,
boot: power.boot.unwrap_or_default(),
awake: power.awake.unwrap_or_default(),
sleep: power.sleep.unwrap_or_default(),
shutdown: false,
});
}
let states = LaptopAuraPower { states };
aura.set_led_power(states)?; aura.set_led_power(states)?;
Ok(()) Ok(())
} }
@@ -826,8 +855,8 @@ fn handle_fan_curve(
if let Some(profile) = cmd.mod_profile { if let Some(profile) = cmd.mod_profile {
if cmd.enable_fan_curves.is_none() && cmd.data.is_none() { if cmd.enable_fan_curves.is_none() && cmd.data.is_none() {
let data = fan_proxy.fan_curve_data(profile)?; let data = fan_proxy.fan_curve_data(profile)?;
let data = toml::to_string(&data)?; let ron = ron::ser::to_string_pretty(&data, PrettyConfig::new().depth_limit(4))?;
println!("\nFan curves for {:?}\n\n{}", profile, data); println!("\nFan curves for {:?}\n\n{}", profile, ron);
} }
if let Some(enabled) = cmd.enable_fan_curves { if let Some(enabled) = cmd.enable_fan_curves {
+11 -9
View File
@@ -1,10 +1,12 @@
[package] [package]
name = "asusd-user" name = "asusd-user"
license = "MPL-2.0" license.workspace = true
version.workspace = true version.workspace = true
authors = ["Luke D Jones <luke@ljones.dev>"] readme.workspace = true
edition = "2021" authors.workspace = true
description = "Usermode daemon for user settings, anime, per-key lighting" repository.workspace = true
homepage.workspace = true
edition.workspace = true
[[bin]] [[bin]]
name = "asusd-user" name = "asusd-user"
@@ -16,8 +18,8 @@ smol.workspace = true
# serialisation # serialisation
serde.workspace = true serde.workspace = true
serde_json.workspace = true
serde_derive.workspace = true serde_derive.workspace = true
ron.workspace = true
rog_anime = { path = "../rog-anime" } rog_anime = { path = "../rog-anime" }
rog_aura = { path = "../rog-aura" } rog_aura = { path = "../rog-aura" }
@@ -26,10 +28,10 @@ rog_platform = { path = "../rog-platform" }
config-traits = { path = "../config-traits" } config-traits = { path = "../config-traits" }
zbus.workspace = true zbus.workspace = true
# cli and logging
log.workspace = true
env_logger.workspace = true env_logger.workspace = true
[dev-dependencies] [dev-dependencies]
cargo-husky.workspace = true cargo-husky.workspace = true
[package.metadata.cargo-machete]
ignored = ["serde"]
+16 -18
View File
@@ -8,6 +8,7 @@ use config_traits::StdConfig;
use rog_anime::error::AnimeError; use rog_anime::error::AnimeError;
use rog_anime::{ActionData, ActionLoader, AnimTime, Fade, Sequences, Vec2}; use rog_anime::{ActionData, ActionLoader, AnimTime, Fade, Sequences, Vec2};
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use ron::ser::PrettyConfig;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use zbus::interface; use zbus::interface;
use zbus::zvariant::{ObjectPath, Type}; use zbus::zvariant::{ObjectPath, Type};
@@ -199,11 +200,12 @@ impl CtrlAnime<'static> {
config.anime.push(action); config.anime.push(action);
config.write(); config.write();
let json = serde_json::to_string_pretty(&*config).expect("Parse config to JSON failed"); let ron = ron::ser::to_string_pretty(&*config, PrettyConfig::new().depth_limit(4))
.expect("Parse config to RON failed");
// Release the inner run loop again // Release the inner run loop again
self.inner_early_return.store(false, Ordering::SeqCst); self.inner_early_return.store(false, Ordering::SeqCst);
return Ok(json); return Ok(ron);
} }
Err(zbus::fdo::Error::Failed("UserConfig lock fail".into())) Err(zbus::fdo::Error::Failed("UserConfig lock fail".into()))
} }
@@ -244,12 +246,11 @@ impl CtrlAnime<'static> {
config.anime.push(action); config.anime.push(action);
config.write(); config.write();
let json = let ron = ron::ser::to_string_pretty(&*config, PrettyConfig::new().depth_limit(4))
serde_json::to_string_pretty(&*config.anime).expect("Parse config to JSON failed"); .expect("Parse config to RON failed");
// Release the inner run loop again // Release the inner run loop again
self.inner_early_return.store(false, Ordering::SeqCst); self.inner_early_return.store(false, Ordering::SeqCst);
return Ok(json); return Ok(ron);
} }
Err(zbus::fdo::Error::Failed("UserConfig lock fail".into())) Err(zbus::fdo::Error::Failed("UserConfig lock fail".into()))
} }
@@ -289,12 +290,11 @@ impl CtrlAnime<'static> {
config.anime.push(action); config.anime.push(action);
config.write(); config.write();
let json = let ron = ron::ser::to_string_pretty(&*config, PrettyConfig::new().depth_limit(4))
serde_json::to_string_pretty(&*config.anime).expect("Parse config to JSON failed"); .expect("Parse config to RON failed");
// Release the inner run loop again // Release the inner run loop again
self.inner_early_return.store(false, Ordering::SeqCst); self.inner_early_return.store(false, Ordering::SeqCst);
return Ok(json); return Ok(ron);
} }
Err(zbus::fdo::Error::Failed("UserConfig lock fail".into())) Err(zbus::fdo::Error::Failed("UserConfig lock fail".into()))
} }
@@ -314,12 +314,11 @@ impl CtrlAnime<'static> {
config.anime.push(action); config.anime.push(action);
config.write(); config.write();
let json = let ron = ron::ser::to_string_pretty(&*config, PrettyConfig::new().depth_limit(4))
serde_json::to_string_pretty(&*config.anime).expect("Parse config to JSON failed"); .expect("Parse config to RON failed");
// Release the inner run loop again // Release the inner run loop again
self.inner_early_return.store(false, Ordering::SeqCst); self.inner_early_return.store(false, Ordering::SeqCst);
return Ok(json); return Ok(ron);
} }
Err(zbus::fdo::Error::Failed("UserConfig lock fail".into())) Err(zbus::fdo::Error::Failed("UserConfig lock fail".into()))
} }
@@ -337,12 +336,11 @@ impl CtrlAnime<'static> {
} }
config.write(); config.write();
let json = let ron = ron::ser::to_string_pretty(&*config, PrettyConfig::new().depth_limit(4))
serde_json::to_string_pretty(&*config.anime).expect("Parse config to JSON failed"); .expect("Parse config to RON failed");
// Release the inner run loop again // Release the inner run loop again
self.inner_early_return.store(false, Ordering::SeqCst); self.inner_early_return.store(false, Ordering::SeqCst);
return Ok(json); return Ok(ron);
} }
Err(zbus::fdo::Error::Failed("UserConfig lock fail".into())) Err(zbus::fdo::Error::Failed("UserConfig lock fail".into()))
} }
+3 -8
View File
@@ -11,8 +11,7 @@ use rog_aura::aura_detection::LedSupportData;
use rog_aura::keyboard::KeyLayout; use rog_aura::keyboard::KeyLayout;
use rog_dbus::zbus_anime::AnimeProxyBlocking; use rog_dbus::zbus_anime::AnimeProxyBlocking;
use rog_dbus::zbus_aura::AuraProxyBlocking; use rog_dbus::zbus_aura::AuraProxyBlocking;
use rog_dbus::zbus_platform::PlatformProxyBlocking; use rog_dbus::{list_iface_blocking, DBUS_NAME};
use rog_dbus::DBUS_NAME;
use smol::Executor; use smol::Executor;
use zbus::Connection; use zbus::Connection;
@@ -36,18 +35,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("rog-platform v{}", rog_platform::VERSION); println!("rog-platform v{}", rog_platform::VERSION);
let conn = zbus::blocking::Connection::system().unwrap(); let conn = zbus::blocking::Connection::system().unwrap();
let platform_proxy = PlatformProxyBlocking::new(&conn).unwrap();
let supported = platform_proxy let supported = list_iface_blocking()?;
.supported_interfaces()
.unwrap_or_default()
.contains(&"Anime".to_string());
let config = ConfigBase::new().load(); let config = ConfigBase::new().load();
let executor = Executor::new(); let executor = Executor::new();
let early_return = Arc::new(AtomicBool::new(false)); let early_return = Arc::new(AtomicBool::new(false));
// Set up the anime data and run loop/thread // Set up the anime data and run loop/thread
if supported { if supported.contains(&"org.asuslinux.Anime".to_string()) {
if let Some(cfg) = config.active_anime { if let Some(cfg) = config.active_anime {
let anime_type = get_anime_type()?; let anime_type = get_anime_type()?;
let anime_config = ConfigAnime::new().set_name(cfg).load(); let anime_config = ConfigAnime::new().set_name(cfg).load();
+10 -9
View File
@@ -1,13 +1,13 @@
[package] [package]
name = "asusd" name = "asusd"
license = "MPL-2.0" license.workspace = true
version.workspace = true version.workspace = true
readme = "README.md" readme.workspace = true
authors = ["Luke <luke@ljones.dev>"] authors.workspace = true
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl" repository.workspace = true
homepage = "https://gitlab.com/asus-linux/asus-nb-ctrl" homepage.workspace = true
description = "A daemon app for ASUS GX502 and similar laptops to control missing features" description.workspace = true
edition = "2021" edition.workspace = true
[[bin]] [[bin]]
name = "asusd" name = "asusd"
@@ -42,7 +42,8 @@ serde_derive.workspace = true
concat-idents.workspace = true concat-idents.workspace = true
systemd-zbus = "*"
[dev-dependencies] [dev-dependencies]
cargo-husky.workspace = true cargo-husky.workspace = true
[package.metadata.cargo-machete]
ignored = ["serde"]
+9 -78
View File
@@ -1,4 +1,4 @@
use config_traits::{StdConfig, StdConfigLoad3}; use config_traits::{StdConfig, StdConfigLoad1};
use rog_platform::cpu::CPUEPP; use rog_platform::cpu::CPUEPP;
use rog_platform::platform::ThrottlePolicy; use rog_platform::platform::ThrottlePolicy;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
@@ -31,18 +31,25 @@ pub struct Config {
/// The energy_performance_preference for this throttle/platform profile /// The energy_performance_preference for this throttle/platform profile
pub throttle_performance_epp: CPUEPP, pub throttle_performance_epp: CPUEPP,
/// Defaults to `None` if not supported /// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_pl1_spl: Option<u8>, pub ppt_pl1_spl: Option<u8>,
/// Defaults to `None` if not supported /// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_pl2_sppt: Option<u8>, pub ppt_pl2_sppt: Option<u8>,
/// Defaults to `None` if not supported /// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_fppt: Option<u8>, pub ppt_fppt: Option<u8>,
/// Defaults to `None` if not supported /// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_apu_sppt: Option<u8>, pub ppt_apu_sppt: Option<u8>,
/// Defaults to `None` if not supported /// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub ppt_platform_sppt: Option<u8>, pub ppt_platform_sppt: Option<u8>,
/// Defaults to `None` if not supported /// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub nv_dynamic_boost: Option<u8>, pub nv_dynamic_boost: Option<u8>,
/// Defaults to `None` if not supported /// Defaults to `None` if not supported
#[serde(skip_serializing_if = "Option::is_none", default)]
pub nv_temp_target: Option<u8>, pub nv_temp_target: Option<u8>,
/// Temporary state for AC/Batt /// Temporary state for AC/Batt
#[serde(skip)] #[serde(skip)]
@@ -99,7 +106,7 @@ impl StdConfig for Config {
} }
} }
impl StdConfigLoad3<Config472, Config506, Config507> for Config {} impl StdConfigLoad1<Config507> for Config {}
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
pub struct Config507 { pub struct Config507 {
@@ -150,79 +157,3 @@ impl From<Config507> for Config {
} }
} }
} }
#[derive(Deserialize, Serialize)]
pub struct Config506 {
/// Save charge limit for restoring on boot
pub charge_control_end_threshold: u8,
pub panel_od: bool,
pub mini_led_mode: bool,
pub disable_nvidia_powerd_on_battery: bool,
pub ac_command: String,
pub bat_command: String,
/// Restored on boot as well as when power is plugged
#[serde(skip)]
pub platform_policy_to_restore: ThrottlePolicy,
pub platform_policy_on_battery: ThrottlePolicy,
pub platform_policy_on_ac: ThrottlePolicy,
//
pub ppt_pl1_spl: Option<u8>,
pub ppt_pl2_sppt: Option<u8>,
pub ppt_fppt: Option<u8>,
pub ppt_apu_sppt: Option<u8>,
pub ppt_platform_sppt: Option<u8>,
pub nv_dynamic_boost: Option<u8>,
pub nv_temp_target: Option<u8>,
}
impl From<Config506> for Config {
fn from(c: Config506) -> Self {
Self {
charge_control_end_threshold: c.charge_control_end_threshold,
panel_od: c.panel_od,
boot_sound: false,
disable_nvidia_powerd_on_battery: c.disable_nvidia_powerd_on_battery,
ac_command: c.ac_command,
bat_command: c.bat_command,
mini_led_mode: c.mini_led_mode,
throttle_policy_linked_epp: true,
throttle_policy_on_battery: c.platform_policy_on_battery,
throttle_policy_on_ac: c.platform_policy_on_ac,
throttle_quiet_epp: CPUEPP::Power,
throttle_balanced_epp: CPUEPP::BalancePower,
throttle_performance_epp: CPUEPP::Performance,
ppt_pl1_spl: c.ppt_pl1_spl,
ppt_pl2_sppt: c.ppt_pl2_sppt,
ppt_fppt: c.ppt_fppt,
ppt_apu_sppt: c.ppt_apu_sppt,
ppt_platform_sppt: c.ppt_platform_sppt,
nv_dynamic_boost: c.nv_dynamic_boost,
nv_temp_target: c.nv_temp_target,
last_power_plugged: 0,
}
}
}
#[derive(Deserialize, Serialize)]
pub struct Config472 {
/// Save charge limit for restoring on boot
pub bat_charge_limit: u8,
pub panel_od: bool,
pub mini_led_mode: bool,
pub disable_nvidia_powerd_on_battery: bool,
pub ac_command: String,
pub bat_command: String,
}
impl From<Config472> for Config {
fn from(c: Config472) -> Self {
Self {
charge_control_end_threshold: c.bat_charge_limit,
panel_od: c.panel_od,
disable_nvidia_powerd_on_battery: true,
ac_command: c.ac_command,
bat_command: c.bat_command,
..Default::default()
}
}
}
+3 -1
View File
@@ -8,6 +8,7 @@ use std::sync::Arc;
use std::thread::sleep; use std::thread::sleep;
use ::zbus::export::futures_util::lock::Mutex; use ::zbus::export::futures_util::lock::Mutex;
use config_traits::{StdConfig, StdConfigLoad2};
use log::{error, info, warn}; use log::{error, info, warn};
use rog_anime::error::AnimeError; use rog_anime::error::AnimeError;
use rog_anime::usb::{ use rog_anime::usb::{
@@ -62,7 +63,7 @@ pub struct CtrlAnime {
impl CtrlAnime { impl CtrlAnime {
#[inline] #[inline]
pub fn new(config: AnimeConfig) -> Result<CtrlAnime, RogError> { pub fn new() -> Result<CtrlAnime, RogError> {
let usb = USBRaw::new(0x193b).ok(); let usb = USBRaw::new(0x193b).ok();
let hid = HidRaw::new("193b").ok(); let hid = HidRaw::new("193b").ok();
let node = if usb.is_some() { let node = if usb.is_some() {
@@ -89,6 +90,7 @@ impl CtrlAnime {
// } // }
// } // }
let config = AnimeConfig::new().load();
let mut anime_type = get_anime_type()?; let mut anime_type = get_anime_type()?;
if let AnimeType::Unknown = anime_type { if let AnimeType::Unknown = anime_type {
if let Some(model) = config.model_override { if let Some(model) = config.model_override {
+1
View File
@@ -16,6 +16,7 @@ pub struct AuraConfig {
pub brightness: LedBrightness, pub brightness: LedBrightness,
pub current_mode: AuraModeNum, pub current_mode: AuraModeNum,
pub builtins: BTreeMap<AuraModeNum, AuraEffect>, pub builtins: BTreeMap<AuraModeNum, AuraEffect>,
#[serde(skip_serializing_if = "Option::is_none", default)]
pub multizone: Option<BTreeMap<AuraModeNum, Vec<AuraEffect>>>, pub multizone: Option<BTreeMap<AuraModeNum, Vec<AuraEffect>>>,
pub multizone_on: bool, pub multizone_on: bool,
pub enabled: LaptopAuraPower, pub enabled: LaptopAuraPower,
+171 -70
View File
@@ -1,6 +1,7 @@
use std::collections::{BTreeMap, HashSet}; use std::collections::{BTreeMap, HashSet};
use config_traits::{StdConfig, StdConfigLoad}; use config_traits::{StdConfig, StdConfigLoad};
use dmi_id::DMIID;
use inotify::Inotify; use inotify::Inotify;
use log::{debug, info, warn}; use log::{debug, info, warn};
use rog_aura::aura_detection::LedSupportData; use rog_aura::aura_detection::LedSupportData;
@@ -10,19 +11,23 @@ use rog_aura::{
AuraDeviceType, AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN, AuraDeviceType, AuraEffect, Direction, LedBrightness, Speed, GRADIENT, LED_MSG_LEN,
}; };
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use rog_platform::keyboard_led::KeyboardLed; use rog_platform::keyboard_led::KeyboardBacklight;
use udev::Device;
use zbus::zvariant::OwnedObjectPath; use zbus::zvariant::OwnedObjectPath;
use zbus::Connection;
use super::config::AuraConfig; use super::config::AuraConfig;
use crate::ctrl_aura::manager::{dbus_path_for_dev, dbus_path_for_tuf}; use crate::ctrl_aura::manager::{dbus_path_for_dev, dbus_path_for_tuf, start_tasks};
use crate::ctrl_aura::trait_impls::CtrlAuraZbus;
use crate::error::RogError; use crate::error::RogError;
use crate::CtrlTask;
#[derive(Debug)] #[derive(Debug)]
pub enum LEDNode { pub enum LEDNode {
/// Brightness and/or TUF RGB controls /// Brightness and/or TUF RGB controls
KbdLed(KeyboardLed), KbdLed(KeyboardBacklight),
/// Raw HID handle /// Raw HID handle
Rog(KeyboardLed, HidRaw), Rog(Option<KeyboardBacklight>, HidRaw),
} }
impl LEDNode { impl LEDNode {
@@ -30,7 +35,13 @@ impl LEDNode {
pub fn set_brightness(&self, value: u8) -> Result<(), RogError> { pub fn set_brightness(&self, value: u8) -> Result<(), RogError> {
match self { match self {
LEDNode::KbdLed(k) => k.set_brightness(value)?, LEDNode::KbdLed(k) => k.set_brightness(value)?,
LEDNode::Rog(k, _) => k.set_brightness(value)?, LEDNode::Rog(k, _) => {
if let Some(k) = k {
k.set_brightness(value)?
} else {
debug!("No brightness control found");
}
}
} }
Ok(()) Ok(())
} }
@@ -38,16 +49,47 @@ impl LEDNode {
pub fn get_brightness(&self) -> Result<u8, RogError> { pub fn get_brightness(&self) -> Result<u8, RogError> {
Ok(match self { Ok(match self {
LEDNode::KbdLed(k) => k.get_brightness()?, LEDNode::KbdLed(k) => k.get_brightness()?,
LEDNode::Rog(k, _) => k.get_brightness()?, LEDNode::Rog(k, _) => {
if let Some(k) = k {
k.get_brightness()?
} else {
debug!("No brightness control found");
return Err(RogError::MissingFunction(
"No keyboard brightness control found".to_string(),
));
}
}
}) })
} }
pub fn monitor_brightness(&self) -> Result<Inotify, RogError> { pub fn monitor_brightness(&self) -> Result<Inotify, RogError> {
Ok(match self { Ok(match self {
LEDNode::KbdLed(k) => k.monitor_brightness()?, LEDNode::KbdLed(k) => k.monitor_brightness()?,
LEDNode::Rog(k, _) => k.monitor_brightness()?, LEDNode::Rog(k, _) => {
if let Some(k) = k {
k.monitor_brightness()?
} else {
debug!("No brightness control found");
return Err(RogError::MissingFunction(
"No keyboard brightness control found".to_string(),
));
}
}
}) })
} }
pub fn has_brightness_control(&self) -> bool {
match self {
LEDNode::KbdLed(k) => k.has_brightness(),
LEDNode::Rog(k, _) => {
if let Some(k) = k {
k.has_brightness()
} else {
false
}
}
}
}
} }
/// Individual controller for one Aura device /// Individual controller for one Aura device
@@ -61,10 +103,85 @@ pub struct CtrlKbdLed {
} }
impl CtrlKbdLed { impl CtrlKbdLed {
pub fn add_to_dbus_and_start(
self,
interfaces: &mut HashSet<OwnedObjectPath>,
conn: Connection,
) -> Result<(), RogError> {
let dbus_path = self.dbus_path.clone();
let dbus_path_cpy = self.dbus_path.clone();
info!(
"AuraManager starting device at: {:?}, {:?}",
dbus_path, self.led_type
);
let conn_copy = conn.clone();
let sig_ctx1 = CtrlAuraZbus::signal_context(&conn_copy)?;
let sig_ctx2 = CtrlAuraZbus::signal_context(&conn_copy)?;
let zbus = CtrlAuraZbus::new(self, sig_ctx1);
tokio::spawn(
async move { start_tasks(zbus, conn_copy.clone(), sig_ctx2, dbus_path).await },
);
interfaces.insert(dbus_path_cpy);
Ok(())
}
/// Build and init a `CtrlKbdLed` from a udev device. Maybe.
/// This will initialise the config also.
pub fn maybe_device(
device: Device,
interfaces: &mut HashSet<OwnedObjectPath>,
) -> Result<Option<Self>, RogError> {
// usb_device gives us a product and vendor ID
if let Some(usb_device) = device.parent_with_subsystem_devtype("usb", "usb_device")? {
let dbus_path = dbus_path_for_dev(&usb_device).unwrap_or_default();
if interfaces.contains(&dbus_path) {
debug!("Already a ctrl at {dbus_path:?}, ignoring this end-point");
return Ok(None);
}
// The asus_wmi driver latches MCU that controls the USB endpoints
if let Some(parent) = device.parent() {
if let Some(driver) = parent.driver() {
// There is a tree of devices added so filter by driver
if driver != "asus" {
return Ok(None);
}
} else {
return Ok(None);
}
}
// 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 prod_id = String::new();
if let Some(usb_id) = usb_device.attribute_value("idProduct") {
prod_id = usb_id.to_string_lossy().to_string();
let aura_device = AuraDeviceType::from(prod_id.as_str());
if aura_device == AuraDeviceType::Unknown {
log::debug!("Unknown or invalid device: {usb_id:?}, skipping");
return Ok(None);
}
}
let dev_node = if let Some(dev_node) = usb_device.devnode() {
dev_node
} else {
debug!("Device has no devnode, skipping");
return Ok(None);
};
info!("AuraControl found device at: {:?}", dev_node);
let dev = HidRaw::from_device(device)?;
let mut controller = Self::from_hidraw(dev, dbus_path.clone())?;
controller.config = Self::init_config(&prod_id);
interfaces.insert(dbus_path);
return Ok(Some(controller));
}
Ok(None)
}
pub fn find_all() -> Result<Vec<Self>, RogError> { pub fn find_all() -> Result<Vec<Self>, RogError> {
info!("Searching for all Aura devices"); info!("Searching for all Aura devices");
let mut devices = Vec::new(); let mut devices = Vec::new();
let mut found = HashSet::new(); // track and ensure we use only one hidraw per prod_id let mut interfaces = HashSet::new(); // track and ensure we use only one hidraw per prod_id
let mut enumerator = udev::Enumerator::new().map_err(|err| { let mut enumerator = udev::Enumerator::new().map_err(|err| {
warn!("{}", err); warn!("{}", err);
@@ -77,63 +194,37 @@ impl CtrlKbdLed {
})?; })?;
for end_point in enumerator.scan_devices()? { for end_point in enumerator.scan_devices()? {
// usb_device gives us a product and vendor ID // maybe?
if let Some(usb_device) = if let Some(device) = Self::maybe_device(end_point, &mut interfaces)? {
end_point.parent_with_subsystem_devtype("usb", "usb_device")? devices.push(device);
{
// 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
let mut prod_id = String::new();
if let Some(usb_id) = usb_device.attribute_value("idProduct") {
prod_id = usb_id.to_string_lossy().to_string();
let aura_dev = AuraDeviceType::from(prod_id.as_str());
if aura_dev == AuraDeviceType::Unknown || found.contains(&aura_dev) {
log::debug!("Unknown or invalid device: {usb_id:?}, skipping");
continue;
}
found.insert(aura_dev);
}
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 mut dev = Self::from_hidraw(dev, dbus_path)?;
dev.config = Self::init_config(&prod_id);
devices.push(dev);
} }
} }
// Check for a TUF laptop LED. Assume there is only ever one. // Check for a TUF laptop LED. Assume there is only ever one.
if let Ok(tuf_kbd) = KeyboardLed::new() { if let Ok(kbd_backlight) = KeyboardBacklight::new() {
if tuf_kbd.has_kbd_rgb_mode() { if kbd_backlight.has_kbd_rgb_mode() {
info!("AuraControl found a TUF laptop keyboard"); // Extra sure double-check that this isn't a laptop with crap
let ctrl = CtrlKbdLed { // ACPI with borked return on the TUF rgb methods
led_type: AuraDeviceType::LaptopTuf, let dmi = DMIID::new().unwrap_or_default();
led_node: LEDNode::KbdLed(tuf_kbd), info!("Found a TUF with product family: {}", dmi.product_family);
supported_data: LedSupportData::get_data("tuf"), info!("and board name: {}", dmi.board_name);
per_key_mode_active: false,
config: Self::init_config("tuf"), if dmi.product_family.contains("TUF") {
dbus_path: dbus_path_for_tuf(), info!("AuraControl found a TUF laptop keyboard");
}; let ctrl = CtrlKbdLed {
devices.push(ctrl); led_type: AuraDeviceType::LaptopTuf,
led_node: LEDNode::KbdLed(kbd_backlight),
supported_data: LedSupportData::get_data("tuf"),
per_key_mode_active: false,
config: Self::init_config("tuf"),
dbus_path: dbus_path_for_tuf(),
};
devices.push(ctrl);
}
} }
} else {
let dmi = DMIID::new().unwrap_or_default();
warn!("No asus::kbd_backlight found for {} ??", dmi.product_family);
} }
info!("Found {} Aura devices", devices.len()); info!("Found {} Aura devices", devices.len());
@@ -145,7 +236,14 @@ impl CtrlKbdLed {
/// should be overwritten. The reason for the default config is because /// should be overwritten. The reason for the default config is because
/// of async issues between this and udev/hidraw /// of async issues between this and udev/hidraw
pub fn from_hidraw(device: HidRaw, dbus_path: OwnedObjectPath) -> Result<Self, RogError> { pub fn from_hidraw(device: HidRaw, dbus_path: OwnedObjectPath) -> Result<Self, RogError> {
let rgb_led = KeyboardLed::new()?; let rgb_led = KeyboardBacklight::new()
.map_err(|e| {
log::error!(
"{} is missing a keyboard backlight brightness control: {e:?}",
device.prod_id()
);
})
.ok();
let prod_id = AuraDeviceType::from(device.prod_id()); let prod_id = AuraDeviceType::from(device.prod_id());
if prod_id == AuraDeviceType::Unknown { if prod_id == AuraDeviceType::Unknown {
log::error!("{} is AuraDevice::Unknown", device.prod_id()); log::error!("{} is AuraDevice::Unknown", device.prod_id());
@@ -208,13 +306,10 @@ impl CtrlKbdLed {
/// Set combination state for boot animation/sleep animation/all leds/keys /// Set combination state for boot animation/sleep animation/all leds/keys
/// leds/side leds LED active /// leds/side leds LED active
pub(super) fn set_power_states(&mut self) -> Result<(), RogError> { pub(super) fn set_power_states(&mut self) -> Result<(), RogError> {
if let LEDNode::KbdLed(_platform) = &mut self.led_node { if let LEDNode::KbdLed(platform) = &mut self.led_node {
// TODO: tuf bool array // TODO: tuf bool array
// if let Some(pwr) = let buf = self.config.enabled.to_bytes(self.led_type);
// AuraPowerConfig::to_tuf_bool_array(&self.config.enabled) { platform.set_kbd_rgb_state(&buf)?;
// let buf = [1, pwr[1] as u8, pwr[2] as u8, pwr[3] as u8,
// pwr[4] as u8]; platform.set_kbd_rgb_state(&buf)?;
// }
} else if let LEDNode::Rog(_, hid_raw) = &self.led_node { } else if let LEDNode::Rog(_, hid_raw) = &self.led_node {
let bytes = self.config.enabled.to_bytes(self.led_type); let bytes = self.config.enabled.to_bytes(self.led_type);
let message = [0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]]; let message = [0x5d, 0xbd, 0x01, bytes[0], bytes[1], bytes[2], bytes[3]];
@@ -364,7 +459,7 @@ mod tests {
use rog_aura::aura_detection::LedSupportData; use rog_aura::aura_detection::LedSupportData;
use rog_aura::{AuraDeviceType, AuraModeNum, AuraZone, PowerZones}; use rog_aura::{AuraDeviceType, AuraModeNum, AuraZone, PowerZones};
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use rog_platform::keyboard_led::KeyboardLed; use rog_platform::keyboard_led::KeyboardBacklight;
use zbus::zvariant::OwnedObjectPath; use zbus::zvariant::OwnedObjectPath;
use super::CtrlKbdLed; use super::CtrlKbdLed;
@@ -387,7 +482,10 @@ mod tests {
}; };
let mut controller = CtrlKbdLed { let mut controller = CtrlKbdLed {
led_type: AuraDeviceType::LaptopPost2021, led_type: AuraDeviceType::LaptopPost2021,
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("19b6").unwrap()), led_node: LEDNode::Rog(
Some(KeyboardBacklight::default()),
HidRaw::new("19b6").unwrap(),
),
supported_data: supported_basic_modes, supported_data: supported_basic_modes,
per_key_mode_active: false, per_key_mode_active: false,
config, config,
@@ -428,7 +526,10 @@ mod tests {
}; };
let mut controller = CtrlKbdLed { let mut controller = CtrlKbdLed {
led_type: AuraDeviceType::LaptopPost2021, led_type: AuraDeviceType::LaptopPost2021,
led_node: LEDNode::Rog(KeyboardLed::default(), HidRaw::new("19b6").unwrap()), led_node: LEDNode::Rog(
Some(KeyboardBacklight::default()),
HidRaw::new("19b6").unwrap(),
),
supported_data: supported_basic_modes, supported_data: supported_basic_modes,
per_key_mode_active: false, per_key_mode_active: false,
config, config,
+37 -85
View File
@@ -6,10 +6,8 @@
use std::collections::HashSet; use std::collections::HashSet;
use log::{debug, error, info, warn}; use log::{error, info, warn};
use mio::{Events, Interest, Poll, Token}; use mio::{Events, Interest, Poll, Token};
use rog_aura::AuraDeviceType;
use rog_platform::hid_raw::HidRaw;
use tokio::task::spawn_blocking; use tokio::task::spawn_blocking;
use udev::{Device, MonitorBuilder}; use udev::{Device, MonitorBuilder};
use zbus::object_server::SignalContext; use zbus::object_server::SignalContext;
@@ -59,93 +57,42 @@ impl AuraManager {
continue; continue;
} }
for event in monitor.iter() { for event in monitor.iter() {
let parent = if let Some(parent) = let action = event.action().unwrap_or_default();
if let Some(parent) =
event.parent_with_subsystem_devtype("usb", "usb_device")? event.parent_with_subsystem_devtype("usb", "usb_device")?
{ {
parent if action == "remove" {
} else { if let Some(path) = dbus_path_for_dev(&parent) {
continue; if interfaces.remove(&path) {
}; info!("AuraManager removing: {path:?}");
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 = AuraDeviceType::from(&*id_product);
if aura_device == AuraDeviceType::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::<CtrlAuraZbus, _>(&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;
}
// 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;
}
}
if let Some(dev_node) = event.devnode() {
if let Ok(raw) = HidRaw::from_device(event.device())
.map_err(|e| error!("device path error: {e:?}"))
{
if let Ok(mut ctrl) = CtrlKbdLed::from_hidraw(raw, path.clone()) {
ctrl.config = CtrlKbdLed::init_config(&id_product);
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(); let conn_copy = conn_copy.clone();
tokio::spawn(async move { tokio::spawn(async move {
start_tasks(zbus, conn_copy.clone(), sig_ctx, path).await let res = conn_copy
.object_server()
.remove::<CtrlAuraZbus, _>(&path)
.await
.map_err(|e| {
error!("Failed to remove {path:?}, {e:?}");
e
})?;
info!("AuraManager removed: {path:?}, {res}");
Ok::<(), RogError>(())
}); });
} }
} }
} } else if action == "add" {
}; if let Ok(Some(ctrl)) =
CtrlKbdLed::maybe_device(event.device(), &mut interfaces)
{
ctrl.add_to_dbus_and_start(&mut interfaces, conn_copy.clone())
.map_err(|e| {
error!("Couldn't start aura device on dbus: {e:?}")
})
.ok();
}
};
}
} }
} }
// Required for return type on spawn // Required for return type on spawn
@@ -169,7 +116,7 @@ pub(crate) fn dbus_path_for_tuf() -> OwnedObjectPath {
ObjectPath::from_str_unchecked(&format!("{AURA_ZBUS_PATH}/tuf")).into() ObjectPath::from_str_unchecked(&format!("{AURA_ZBUS_PATH}/tuf")).into()
} }
async fn start_tasks( pub async fn start_tasks(
mut zbus: CtrlAuraZbus, mut zbus: CtrlAuraZbus,
connection: Connection, connection: Connection,
_signal_ctx: SignalContext<'static>, _signal_ctx: SignalContext<'static>,
@@ -180,7 +127,12 @@ async fn start_tasks(
zbus.reload() zbus.reload()
.await .await
.unwrap_or_else(|err| warn!("Controller error: {}", err)); .unwrap_or_else(|err| warn!("Controller error: {}", err));
connection.object_server().at(path, zbus).await.unwrap(); connection
.object_server()
.at(path.clone(), zbus)
.await
.map_err(|e| error!("Couldn't add server at path: {path}, {e:?}"))
.ok();
// TODO: skip this until we keep handles to tasks so they can be killed // TODO: skip this until we keep handles to tasks so they can be killed
// task.create_tasks(signal_ctx).await // task.create_tasks(signal_ctx).await
Ok(()) Ok(())
+6 -1
View File
@@ -1,3 +1,4 @@
use log::warn;
use udev::Device; use udev::Device;
use zbus::zvariant::{ObjectPath, OwnedObjectPath}; use zbus::zvariant::{ObjectPath, OwnedObjectPath};
@@ -12,7 +13,7 @@ pub mod trait_impls;
pub(super) fn filename_partial(parent: &Device) -> Option<OwnedObjectPath> { pub(super) fn filename_partial(parent: &Device) -> Option<OwnedObjectPath> {
if let Some(id_product) = parent.attribute_value("idProduct") { if let Some(id_product) = parent.attribute_value("idProduct") {
let id_product = id_product.to_string_lossy(); let id_product = id_product.to_string_lossy();
let path = if let Some(devnum) = parent.attribute_value("devnum") { let mut path = if let Some(devnum) = parent.attribute_value("devnum") {
let devnum = devnum.to_string_lossy(); let devnum = devnum.to_string_lossy();
if let Some(devpath) = parent.attribute_value("devpath") { if let Some(devpath) = parent.attribute_value("devpath") {
let devpath = devpath.to_string_lossy(); let devpath = devpath.to_string_lossy();
@@ -23,6 +24,10 @@ pub(super) fn filename_partial(parent: &Device) -> Option<OwnedObjectPath> {
} else { } else {
format!("{id_product}") format!("{id_product}")
}; };
if path.contains('.') {
warn!("dbus path for {id_product} contains `.`, removing");
path = path.replace('.', "").to_owned();
}
return Some(ObjectPath::from_str_unchecked(&path).into()); return Some(ObjectPath::from_str_unchecked(&path).into());
} }
None None
+35 -25
View File
@@ -26,7 +26,7 @@ impl CtrlAuraZbus {
} }
fn update_config(lock: &mut CtrlKbdLed) -> Result<(), RogError> { fn update_config(lock: &mut CtrlKbdLed) -> Result<(), RogError> {
let bright = lock.led_node.get_brightness()?; let bright = lock.led_node.get_brightness().unwrap_or_default();
lock.config.read(); lock.config.read();
lock.config.brightness = bright.into(); lock.config.brightness = bright.into();
lock.config.write(); lock.config.write();
@@ -109,8 +109,10 @@ impl CtrlAuraZbus {
if ctrl.config.brightness == LedBrightness::Off { if ctrl.config.brightness == LedBrightness::Off {
ctrl.config.brightness = LedBrightness::Med; ctrl.config.brightness = LedBrightness::Med;
} }
ctrl.led_node if ctrl.led_node.has_brightness_control() {
.set_brightness(ctrl.config.brightness.into())?; ctrl.led_node
.set_brightness(ctrl.config.brightness.into())?;
}
ctrl.config.write(); ctrl.config.write();
self.led_mode_data_invalidate(&self.1).await.ok(); self.led_mode_data_invalidate(&self.1).await.ok();
@@ -148,8 +150,10 @@ impl CtrlAuraZbus {
if ctrl.config.brightness == LedBrightness::Off { if ctrl.config.brightness == LedBrightness::Off {
ctrl.config.brightness = LedBrightness::Med; ctrl.config.brightness = LedBrightness::Med;
} }
ctrl.led_node if ctrl.led_node.has_brightness_control() {
.set_brightness(ctrl.config.brightness.into())?; ctrl.led_node
.set_brightness(ctrl.config.brightness.into())?;
}
ctrl.config.set_builtin(effect); ctrl.config.set_builtin(effect);
ctrl.config.write(); ctrl.config.write();
@@ -213,12 +217,14 @@ impl CtrlTask for CtrlAuraZbus {
// If waking up // If waking up
if !start { if !start {
info!("CtrlKbdLedTask reloading brightness and modes"); info!("CtrlKbdLedTask reloading brightness and modes");
lock.led_node if lock.led_node.has_brightness_control() {
.set_brightness(lock.config.brightness.into()) lock.led_node
.map_err(|e| { .set_brightness(lock.config.brightness.into())
error!("CtrlKbdLedTask: {e}"); .map_err(|e| {
e error!("CtrlKbdLedTask: {e}");
})?; e
})?;
}
lock.write_current_config_mode().map_err(|e| { lock.write_current_config_mode().map_err(|e| {
error!("CtrlKbdLedTask: {e}"); error!("CtrlKbdLedTask: {e}");
e e
@@ -264,20 +270,24 @@ impl CtrlTask for CtrlAuraZbus {
let ctrl2 = self.0.clone(); let ctrl2 = self.0.clone();
let ctrl = self.0.lock().await; let ctrl = self.0.lock().await;
let watch = ctrl.led_node.monitor_brightness()?; if ctrl.led_node.has_brightness_control() {
tokio::spawn(async move { let watch = ctrl.led_node.monitor_brightness()?;
let mut buffer = [0; 32]; tokio::spawn(async move {
watch let mut buffer = [0; 32];
.into_event_stream(&mut buffer) watch
.unwrap() .into_event_stream(&mut buffer)
.for_each(|_| async { .unwrap()
if let Some(lock) = ctrl2.try_lock() { .for_each(|_| async {
load_save(true, lock).unwrap(); // unwrap as we want to if let Some(lock) = ctrl2.try_lock() {
// bomb out of the task load_save(true, lock).unwrap(); // unwrap as we want
} // to
}) // bomb out of the
.await; // task
}); }
})
.await;
});
}
Ok(()) Ok(())
} }
+24 -17
View File
@@ -720,6 +720,7 @@ impl crate::ZbusRun for CtrlPlatform {
impl ReloadAndNotify for CtrlPlatform { impl ReloadAndNotify for CtrlPlatform {
type Data = Config; type Data = Config;
/// Called on config file changed externally
async fn reload_and_notify( async fn reload_and_notify(
&mut self, &mut self,
signal_context: &SignalContext<'static>, signal_context: &SignalContext<'static>,
@@ -730,8 +731,9 @@ impl ReloadAndNotify for CtrlPlatform {
info!("asusd.ron updated externally, reloading and updating internal copy"); info!("asusd.ron updated externally, reloading and updating internal copy");
if self.power.has_charge_control_end_threshold() { if self.power.has_charge_control_end_threshold() {
self.power let limit = data.charge_control_end_threshold;
.set_charge_control_end_threshold(data.charge_control_end_threshold)?; warn!("setting charge_control_end_threshold to {limit}");
self.power.set_charge_control_end_threshold(limit)?;
self.charge_control_end_threshold_changed(signal_context) self.charge_control_end_threshold_changed(signal_context)
.await?; .await?;
} }
@@ -790,6 +792,15 @@ impl ReloadAndNotify for CtrlPlatform {
impl crate::Reloadable for CtrlPlatform { impl crate::Reloadable for CtrlPlatform {
async fn reload(&mut self) -> Result<(), RogError> { async fn reload(&mut self) -> Result<(), RogError> {
info!("Begin Platform settings restore");
if self.power.has_charge_control_end_threshold() {
let limit = self.config.lock().await.charge_control_end_threshold;
info!("reloading charge_control_end_threshold to {limit}");
self.power.set_charge_control_end_threshold(limit)?;
} else {
warn!("No charge_control_end_threshold found")
}
macro_rules! reload { macro_rules! reload {
($property:tt, $prop_name:literal) => { ($property:tt, $prop_name:literal) => {
concat_idents::concat_idents!(has = has_, $property { concat_idents::concat_idents!(has = has_, $property {
@@ -825,12 +836,6 @@ impl crate::Reloadable for CtrlPlatform {
ppt_reload!(nv_dynamic_boost, "nv_dynamic_boost"); ppt_reload!(nv_dynamic_boost, "nv_dynamic_boost");
ppt_reload!(nv_temp_target, "nv_temp_target"); ppt_reload!(nv_temp_target, "nv_temp_target");
if self.power.has_charge_control_end_threshold() {
self.power.set_charge_control_end_threshold(
self.config.lock().await.charge_control_end_threshold,
)?;
}
if let Ok(power_plugged) = self.power.get_online() { if let Ok(power_plugged) = self.power.get_online() {
self.config.lock().await.last_power_plugged = power_plugged; self.config.lock().await.last_power_plugged = power_plugged;
if self.platform.has_throttle_thermal_policy() { if self.platform.has_throttle_thermal_policy() {
@@ -846,11 +851,11 @@ impl crate::Reloadable for CtrlPlatform {
} }
impl CtrlPlatform { impl CtrlPlatform {
task_watch_item!(panel_od platform); task_watch_item!(panel_od "panel_od" platform);
task_watch_item!(mini_led_mode platform); task_watch_item!(mini_led_mode "mini_led_mode" platform);
task_watch_item!(charge_control_end_threshold power); task_watch_item!(charge_control_end_threshold "charge_control_end_threshold" power);
task_watch_item_notify!(boot_sound platform); task_watch_item_notify!(boot_sound platform);
@@ -900,12 +905,14 @@ impl CtrlTask for CtrlPlatform {
}) })
.ok(); .ok();
} }
if sleeping && platform1.power.has_charge_control_end_threshold() { // Don't store it on suspend, assume that the current config setting is desired
platform1.config.lock().await.charge_control_end_threshold = platform1 // if sleeping && platform1.power.has_charge_control_end_threshold() {
.power // platform1.config.lock().await.charge_control_end_threshold = platform1
.get_charge_control_end_threshold() // .power
.unwrap_or(100); // .get_charge_control_end_threshold()
} else if !sleeping && platform1.power.has_charge_control_end_threshold() { // .unwrap_or(100);
// } else
if !sleeping && platform1.power.has_charge_control_end_threshold() {
platform1 platform1
.power .power
.set_charge_control_end_threshold( .set_charge_control_end_threshold(
+3 -11
View File
@@ -1,6 +1,7 @@
pub mod config; pub mod config;
pub mod trait_impls; pub mod trait_impls;
use config_traits::{StdConfig, StdConfigLoad};
use rog_platform::hid_raw::HidRaw; use rog_platform::hid_raw::HidRaw;
use rog_platform::usb_raw::USBRaw; use rog_platform::usb_raw::USBRaw;
use rog_slash::error::SlashError; use rog_slash::error::SlashError;
@@ -31,19 +32,13 @@ impl Node {
} }
pub struct CtrlSlash { pub struct CtrlSlash {
// node: HidRaw,
node: Node, node: Node,
config: SlashConfig, config: SlashConfig,
// slash_type: SlashType,
// // set to force thread to exit
// thread_exit: Arc<AtomicBool>,
// // Set to false when the thread exits
// thread_running: Arc<AtomicBool>,
} }
impl CtrlSlash { impl CtrlSlash {
#[inline] #[inline]
pub fn new(config: SlashConfig) -> Result<CtrlSlash, RogError> { pub fn new() -> Result<CtrlSlash, RogError> {
let slash_type = get_slash_type()?; let slash_type = get_slash_type()?;
if matches!(slash_type, SlashType::Unknown | SlashType::Unsupported) { if matches!(slash_type, SlashType::Unknown | SlashType::Unsupported) {
return Err(RogError::Slash(SlashError::NoDevice)); return Err(RogError::Slash(SlashError::NoDevice));
@@ -61,10 +56,7 @@ impl CtrlSlash {
let ctrl = CtrlSlash { let ctrl = CtrlSlash {
node, node,
config, config: SlashConfig::new().load(),
// slash_type,
// thread_exit: Arc::new(AtomicBool::new(false)),
// thread_running: Arc::new(AtomicBool::new(false)),
}; };
ctrl.do_initialization()?; ctrl.do_initialization()?;
+4
View File
@@ -33,6 +33,7 @@ impl CtrlSlashZbus {
} }
/// Set enabled true or false /// Set enabled true or false
#[zbus(property)]
async fn set_enabled(&self, enabled: bool) { async fn set_enabled(&self, enabled: bool) {
let mut lock = self.0.lock().await; let mut lock = self.0.lock().await;
let brightness = if enabled && lock.config.slash_brightness == 0 { let brightness = if enabled && lock.config.slash_brightness == 0 {
@@ -64,6 +65,7 @@ impl CtrlSlashZbus {
} }
/// Set brightness level /// Set brightness level
#[zbus(property)]
async fn set_brightness(&self, brightness: u8) { async fn set_brightness(&self, brightness: u8) {
let mut lock = self.0.lock().await; let mut lock = self.0.lock().await;
let enabled = brightness > 0; let enabled = brightness > 0;
@@ -90,6 +92,7 @@ impl CtrlSlashZbus {
} }
/// Set interval between slash animations (0-255) /// Set interval between slash animations (0-255)
#[zbus(property)]
async fn set_interval(&self, interval: u8) { async fn set_interval(&self, interval: u8) {
let mut lock = self.0.lock().await; let mut lock = self.0.lock().await;
lock.node lock.node
@@ -114,6 +117,7 @@ impl CtrlSlashZbus {
} }
/// Set interval between slash animations (0-255) /// Set interval between slash animations (0-255)
#[zbus(property)]
async fn set_slash_mode(&self, slash_mode: SlashMode) { async fn set_slash_mode(&self, slash_mode: SlashMode) {
let mut lock = self.0.lock().await; let mut lock = self.0.lock().await;
+4 -6
View File
@@ -5,17 +5,15 @@ use std::sync::Arc;
use ::zbus::export::futures_util::lock::Mutex; use ::zbus::export::futures_util::lock::Mutex;
use ::zbus::Connection; use ::zbus::Connection;
use asusd::config::Config; use asusd::config::Config;
use asusd::ctrl_anime::config::AnimeConfig;
use asusd::ctrl_anime::trait_impls::CtrlAnimeZbus; use asusd::ctrl_anime::trait_impls::CtrlAnimeZbus;
use asusd::ctrl_anime::CtrlAnime; use asusd::ctrl_anime::CtrlAnime;
use asusd::ctrl_aura::manager::AuraManager; use asusd::ctrl_aura::manager::AuraManager;
use asusd::ctrl_fancurves::CtrlFanCurveZbus; use asusd::ctrl_fancurves::CtrlFanCurveZbus;
use asusd::ctrl_platform::CtrlPlatform; use asusd::ctrl_platform::CtrlPlatform;
use asusd::ctrl_slash::config::SlashConfig;
use asusd::ctrl_slash::trait_impls::CtrlSlashZbus; use asusd::ctrl_slash::trait_impls::CtrlSlashZbus;
use asusd::ctrl_slash::CtrlSlash; use asusd::ctrl_slash::CtrlSlash;
use asusd::{print_board_info, start_tasks, CtrlTask, DBUS_NAME}; use asusd::{print_board_info, start_tasks, CtrlTask, DBUS_NAME};
use config_traits::{StdConfig, StdConfigLoad, StdConfigLoad2, StdConfigLoad3}; use config_traits::{StdConfig, StdConfigLoad1};
use log::{error, info}; use log::{error, info};
use zbus::fdo::ObjectManager; use zbus::fdo::ObjectManager;
@@ -64,7 +62,7 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
let mut connection = Connection::system().await?; let mut connection = Connection::system().await?;
connection connection
.object_server() .object_server()
.at("/org/asuslinux", ObjectManager) .at("/", ObjectManager)
.await .await
.unwrap(); .unwrap();
@@ -98,7 +96,7 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
} }
} }
match CtrlAnime::new(AnimeConfig::new().load()) { match CtrlAnime::new() {
Ok(ctrl) => { Ok(ctrl) => {
let zbus = CtrlAnimeZbus(Arc::new(Mutex::new(ctrl))); let zbus = CtrlAnimeZbus(Arc::new(Mutex::new(ctrl)));
let sig_ctx = CtrlAnimeZbus::signal_context(&connection)?; let sig_ctx = CtrlAnimeZbus::signal_context(&connection)?;
@@ -109,7 +107,7 @@ async fn start_daemon() -> Result<(), Box<dyn Error>> {
} }
} }
match CtrlSlash::new(SlashConfig::new().load()) { match CtrlSlash::new() {
Ok(ctrl) => { Ok(ctrl) => {
let zbus = CtrlSlashZbus(Arc::new(Mutex::new(ctrl))); let zbus = CtrlSlashZbus(Arc::new(Mutex::new(ctrl)));
// Currently, the Slash has no need for a loop watching power events, however, // Currently, the Slash has no need for a loop watching power events, however,
+10 -7
View File
@@ -56,7 +56,7 @@ pub static DBUS_IFACE: &str = "org.asuslinux.Daemon";
/// // TODO: this is kind of useless if it can't trigger some action /// // TODO: this is kind of useless if it can't trigger some action
#[macro_export] #[macro_export]
macro_rules! task_watch_item { macro_rules! task_watch_item {
($name:ident $self_inner:ident) => { ($name:ident $name_str:literal $self_inner:ident) => {
concat_idents::concat_idents!(fn_name = watch_, $name { concat_idents::concat_idents!(fn_name = watch_, $name {
async fn fn_name( async fn fn_name(
&self, &self,
@@ -72,12 +72,15 @@ macro_rules! task_watch_item {
let mut buffer = [0; 32]; let mut buffer = [0; 32];
watch.into_event_stream(&mut buffer).unwrap().for_each(|_| async { watch.into_event_stream(&mut buffer).unwrap().for_each(|_| async {
if let Ok(value) = ctrl.$name() { // get new value from zbus method if let Ok(value) = ctrl.$name() { // get new value from zbus method
concat_idents::concat_idents!(notif_fn = $name, _changed { if ctrl.config.lock().await.$name != value {
ctrl.notif_fn(&signal_ctxt).await.ok(); log::debug!("{} was changed to {} externally", $name_str, value);
}); concat_idents::concat_idents!(notif_fn = $name, _changed {
let mut lock = ctrl.config.lock().await; ctrl.notif_fn(&signal_ctxt).await.ok();
lock.$name = value; });
lock.write(); let mut lock = ctrl.config.lock().await;
lock.$name = value;
lock.write();
}
} }
}).await; }).await;
}); });
+7 -7
View File
@@ -1,18 +1,18 @@
[package] [package]
name = "config-traits" name = "config-traits"
license = "MPL-2.0" license.workspace = true
authors = ["Luke D Jones <luke@ljones.dev>"]
edition = "2021"
version.workspace = true version.workspace = true
readme.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
[dependencies] [dependencies]
serde.workspace = true serde.workspace = true
serde_derive.workspace = true
serde_json.workspace = true
toml.workspace = true
ron.workspace = true ron.workspace = true
log.workspace = true log.workspace = true
[dev-dependencies] [dev-dependencies]
cargo-husky.workspace = true cargo-husky.workspace = true
+2 -17
View File
@@ -3,10 +3,7 @@
//! updating them from previous versions where fields or names are changed in //! updating them from previous versions where fields or names are changed in
//! some way. //! some way.
//! //!
//! The end canonical file format is `.ron` as this supports rust types well, //! The end canonical file format is `.ron` as this supports rust types well
//! and includes the ability to add commenting, and is less verbose than `json`.
//! Currently the crate will also try to parse from `json` and `toml` if the
//! `ron` parsing fails, then update to `ron` format.
use std::fs::{self, create_dir, File, OpenOptions}; use std::fs::{self, create_dir, File, OpenOptions};
use std::io::{Read, Write}; use std::io::{Read, Write};
@@ -221,21 +218,9 @@ macro_rules! std_config_load {
if let Ok(data) = ron::from_str(&buf) { if let Ok(data) = ron::from_str(&buf) {
self = data; self = data;
log::info!("Parsed RON for {:?}", std::any::type_name::<Self>()); log::info!("Parsed RON for {:?}", std::any::type_name::<Self>());
} else if let Ok(data) = serde_json::from_str(&buf) { } $(else if let Ok(data) = ron::from_str::<$generic>(&buf) {
self = data;
log::info!("Parsed JSON for {:?}", std::any::type_name::<Self>());
} else if let Ok(data) = toml::from_str(&buf) {
self = data;
log::info!("Parsed TOML for {:?}", std::any::type_name::<Self>());
} $(else if let Ok(data) = ron::from_str::<$generic>(&buf) {
self = data.into(); self = data.into();
log::info!("New version failed, trying previous: Parsed RON for {:?}", std::any::type_name::<$generic>()); log::info!("New version failed, trying previous: Parsed RON for {:?}", std::any::type_name::<$generic>());
} else if let Ok(data) = serde_json::from_str::<$generic>(&buf) {
self = data.into();
log::info!("New version failed, trying previous: Parsed JSON for {:?}", std::any::type_name::<$generic>());
} else if let Ok(data) = toml::from_str::<$generic>(&buf) {
self = data.into();
log::info!("Newvious version failed, trying previous: Parsed TOML for {:?}", std::any::type_name::<$generic>());
})* else { })* else {
self.rename_file_old(); self.rename_file_old();
self = Self::new(); self = Self::new();
+6 -2
View File
@@ -1,7 +1,11 @@
[package] [package]
name = "cpuctl" name = "cpuctl"
license = "MPL-2.0" license.workspace = true
edition = "2021"
version.workspace = true version.workspace = true
readme.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
[dependencies] [dependencies]
+7 -2
View File
@@ -1,8 +1,13 @@
[package] [package]
name = "dmi_id" name = "dmi_id"
edition = "2021" license.workspace = true
version.workspace = true version.workspace = true
readme.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
[dependencies] [dependencies]
log.workspace = true log.workspace = true
udev.workspace = true udev.workspace = true
+10 -7
View File
@@ -1,15 +1,15 @@
[package] [package]
name = "rog_anime" name = "rog_anime"
license = "MPL-2.0" license.workspace = true
version.workspace = true version.workspace = true
readme = "README.md" readme.workspace = true
authors = ["Luke <luke@ljones.dev>"] authors.workspace = true
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl" repository.workspace = true
homepage = "https://gitlab.com/asus-linux/asus-nb-ctrl" homepage.workspace = true
edition.workspace = true
documentation = "https://docs.rs/rog-anime" documentation = "https://docs.rs/rog-anime"
description = "Types useful for translating images and other data for display on the ASUS AniMe Matrix display" description = "Types useful for translating images and other data for display on the ASUS AniMe Matrix display"
keywords = ["ROG", "ASUS", "AniMe"] keywords = ["ROG", "ASUS", "AniMe"]
edition = "2021"
exclude = ["data"] exclude = ["data"]
[features] [features]
@@ -38,4 +38,7 @@ zbus = { workspace = true, optional = true }
dmi_id = { path = "../dmi-id", optional = true } dmi_id = { path = "../dmi-id", optional = true }
[dev-dependencies] [dev-dependencies]
cargo-husky.workspace = true cargo-husky.workspace = true
[package.metadata.cargo-machete]
ignored = ["serde"]
+1 -1
View File
@@ -29,4 +29,4 @@ typeshare.workspace = true
ron = { version = "*", optional = true } ron = { version = "*", optional = true }
[dev-dependencies] [dev-dependencies]
cargo-husky.workspace = true cargo-husky.workspace = true
+40 -94
View File
@@ -27,7 +27,7 @@
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
( (
device_name: "FX505D", device_name: "FX505",
product_id: "", product_id: "",
layout_name: "fx505d", layout_name: "fx505d",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
@@ -36,25 +36,7 @@
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
( (
device_name: "FX505G", device_name: "FX506",
product_id: "",
layout_name: "fx505d",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "FX506H",
product_id: "",
layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Pulse],
basic_zones: [],
advanced_type: None,
power_zones: [Keyboard],
),
(
device_name: "FX506L",
product_id: "", product_id: "",
layout_name: "fa506i", layout_name: "fa506i",
basic_modes: [Static, Breathe, Strobe, Pulse], basic_modes: [Static, Breathe, Strobe, Pulse],
@@ -98,15 +80,6 @@
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
(
device_name: "G512LV",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
( (
device_name: "G513I", device_name: "G513I",
product_id: "", product_id: "",
@@ -116,6 +89,15 @@
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]), advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar], power_zones: [Keyboard, Lightbar],
), ),
(
device_name: "G513Q",
product_id: "",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
( (
device_name: "G513QE", device_name: "G513QE",
product_id: "", product_id: "",
@@ -125,24 +107,6 @@
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
(
device_name: "G513QM",
product_id: "",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
(
device_name: "G513QR",
product_id: "",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
( (
device_name: "G513QY", device_name: "G513QY",
product_id: "", product_id: "",
@@ -153,16 +117,7 @@
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
( (
device_name: "G513RC", device_name: "G513R",
product_id: "",
layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [],
advanced_type: Zoned([ZonedKbLeft, ZonedKbLeftMid, ZonedKbRightMid, ZonedKbRight, LightbarRight, LightbarRightCorner, LightbarRightBottom, LightbarLeftBottom, LightbarLeftCorner, LightbarLeft]),
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G513RM",
product_id: "", product_id: "",
layout_name: "g513i", layout_name: "g513i",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
@@ -188,15 +143,6 @@
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
(
device_name: "G531",
product_id: "",
layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: PerKey,
power_zones: [Keyboard],
),
( (
device_name: "G531GD", device_name: "G531GD",
product_id: "", product_id: "",
@@ -253,7 +199,7 @@
), ),
( (
device_name: "G533Q", device_name: "G533Q",
product_id: "", product_id: "1866",
layout_name: "g533q-per-key", layout_name: "g533q-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash], basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [], basic_zones: [],
@@ -323,6 +269,15 @@
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
(
device_name: "G713P",
product_id: "",
layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4],
advanced_type: None,
power_zones: [Keyboard],
),
( (
device_name: "G713QM", device_name: "G713QM",
product_id: "", product_id: "",
@@ -373,9 +328,9 @@
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
basic_zones: [Key1, Key2, Key3, Key4], basic_zones: [Key1, Key2, Key3, Key4, BarLeft, BarRight],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard, Lightbar],
), ),
( (
device_name: "G731", device_name: "G731",
@@ -427,9 +382,9 @@
product_id: "", product_id: "",
layout_name: "g513i-per-key", layout_name: "g513i-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash], basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [Logo, BarLeft, BarRight], basic_zones: [],
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard, Lightbar, Logo, Lid],
), ),
( (
device_name: "G733PZ", device_name: "G733PZ",
@@ -459,7 +414,7 @@
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
( (
device_name: "G814JI", device_name: "G814J",
product_id: "", product_id: "",
layout_name: "g814ji-per-key", layout_name: "g814ji-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash], basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
@@ -468,16 +423,7 @@
power_zones: [Keyboard, Lightbar], power_zones: [Keyboard, Lightbar],
), ),
( (
device_name: "G814JZ", device_name: "G834J",
product_id: "",
layout_name: "g814ji-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard, Lightbar],
),
(
device_name: "G834JZ",
product_id: "", product_id: "",
layout_name: "g814ji-per-key", layout_name: "g814ji-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash], basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
@@ -525,13 +471,13 @@
device_name: "GA402XV", device_name: "GA402XV",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse], basic_modes: [Static, Breathe, Strobe, Comet],
basic_zones: [], basic_zones: [],
advanced_type: None, advanced_type: None,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
( (
device_name: "GA403UI", device_name: "GA403U",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Pulse], basic_modes: [Static, Breathe, Pulse],
@@ -638,15 +584,6 @@
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
(
device_name: "GU502G",
product_id: "",
layout_name: "gx502",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
( (
device_name: "GU502L", device_name: "GU502L",
product_id: "", product_id: "",
@@ -675,7 +612,7 @@
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
( (
device_name: "GU603VV", device_name: "GU603V",
product_id: "", product_id: "",
layout_name: "ga401q", layout_name: "ga401q",
basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse], basic_modes: [Static, Breathe, Strobe, Rainbow, Pulse],
@@ -809,6 +746,15 @@
advanced_type: PerKey, advanced_type: PerKey,
power_zones: [Keyboard], power_zones: [Keyboard],
), ),
(
device_name: "GX650R",
product_id: "",
layout_name: "gx531-per-key",
basic_modes: [Static, Breathe, Strobe, Rainbow, Star, Rain, Highlight, Laser, Ripple, Pulse, Comet, Flash],
basic_zones: [],
advanced_type: PerKey,
power_zones: [Keyboard],
),
( (
device_name: "GX701", device_name: "GX701",
product_id: "", product_id: "",
+3 -1
View File
@@ -70,7 +70,9 @@ impl LedSupportData {
} }
} }
info!("Using generic LED control for keyboard brightness only"); info!("Using generic LED control for keyboard brightness only");
LedSupportData::default() let mut data = LedSupportData::default();
data.power_zones.push(PowerZones::Keyboard);
data
} }
} }
+8 -13
View File
@@ -53,7 +53,8 @@ impl AuraPowerState {
} }
fn tuf_to_bytes(&self) -> Vec<u8> { fn tuf_to_bytes(&self) -> Vec<u8> {
todo!("0s and 1s for bool array") // &cmd, &boot, &awake, &sleep, &keyboard
vec![1, self.boot as u8, self.awake as u8, self.sleep as u8, 1]
} }
/// # Bits for older 0x1866 keyboard model /// # Bits for older 0x1866 keyboard model
@@ -81,16 +82,10 @@ impl AuraPowerState {
if self.sleep { if self.sleep {
a |= OldAuraPower::Sleep as u32; a |= OldAuraPower::Sleep as u32;
} }
if matches!( if matches!(self.zone, PowerZones::Keyboard) {
self.zone,
PowerZones::Keyboard | PowerZones::KeyboardAndLightbar
) {
a |= OldAuraPower::Keyboard as u32; a |= OldAuraPower::Keyboard as u32;
} }
if matches!( if matches!(self.zone, PowerZones::Lightbar) {
self.zone,
PowerZones::Lightbar | PowerZones::KeyboardAndLightbar
) {
a |= OldAuraPower::Lightbar as u32; a |= OldAuraPower::Lightbar as u32;
} }
vec![ vec![
@@ -133,7 +128,7 @@ impl AuraPowerState {
| (self.sleep as u32) << (23 + 3) | (self.sleep as u32) << (23 + 3)
| (self.shutdown as u32) << (23 + 4) | (self.shutdown as u32) << (23 + 4)
} }
PowerZones::KeyboardAndLightbar | PowerZones::None => 0, PowerZones::None => 0,
} }
} }
} }
@@ -196,7 +191,7 @@ impl LaptopAuraPower {
AuraDeviceType::LaptopPre2021 => { AuraDeviceType::LaptopPre2021 => {
if support_data.power_zones.contains(&PowerZones::Lightbar) { if support_data.power_zones.contains(&PowerZones::Lightbar) {
Self { Self {
states: vec![AuraPowerState::default_for(PowerZones::KeyboardAndLightbar)], states: vec![AuraPowerState::default_for(PowerZones::Lightbar)],
} }
} else { } else {
Self { Self {
@@ -326,7 +321,7 @@ mod test {
assert_eq!(bytes, [0xc3, 0x12, 0x09, 0x00]); assert_eq!(bytes, [0xc3, 0x12, 0x09, 0x00]);
let power = AuraPowerState { let power = AuraPowerState {
zone: PowerZones::KeyboardAndLightbar, zone: PowerZones::Keyboard,
awake: true, awake: true,
boot: true, boot: true,
sleep: true, sleep: true,
@@ -335,7 +330,7 @@ mod test {
let bytes = power.old_to_bytes(); let bytes = power.old_to_bytes();
println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]); println!("{:08b}, {:08b}, {:08b}", bytes[0], bytes[1], bytes[2]);
assert_eq!(bytes, [0xff, 0x1f, 0x000f, 0x00]); assert_eq!(bytes, [251, 26, 15, 0]);
} }
#[test] #[test]
-2
View File
@@ -126,7 +126,5 @@ pub enum PowerZones {
Lid = 3, Lid = 3,
/// The led strip on the rear of some laptops /// The led strip on the rear of some laptops
RearGlow = 4, RearGlow = 4,
/// On pre-2021 laptops there is either 1 or 2 zones used
KeyboardAndLightbar = 5,
None = 255, None = 255,
} }
+14 -24
View File
@@ -1,19 +1,21 @@
[package] [package]
name = "rog-control-center" name = "rog-control-center"
license = "MPL-2.0" license.workspace = true
version.workspace = true version.workspace = true
authors = ["Luke D. Jones <luke@ljones.dev>"] readme.workspace = true
edition = "2021" authors.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
[features] [features]
#default = ["mocking"] #default = ["mocking"]
#mocking = [] #mocking = []
[dependencies] [dependencies]
nix = { version = "^0.28.0", features = ["fs"] }
betrayer = { git = "https://github.com/flukejones/betrayer.git", features = [ tempfile = "3.3.0"
"winit", betrayer = { version = "0.2.0" }
] }
asusd = { path = "../asusd" } asusd = { path = "../asusd" }
config-traits = { path = "../config-traits" } config-traits = { path = "../config-traits" }
@@ -22,7 +24,7 @@ rog_dbus = { path = "../rog-dbus" }
rog_aura = { path = "../rog-aura" } rog_aura = { path = "../rog-aura" }
rog_profiles = { path = "../rog-profiles" } rog_profiles = { path = "../rog-profiles" }
rog_platform = { path = "../rog-platform" } rog_platform = { path = "../rog-platform" }
supergfxctl = { git = "https://gitlab.com/asus-linux/supergfxctl.git", default-features = false } supergfxctl = { git = "https://gitlab.com/asus-linux/supergfxctl.git", rev = "4eb6e97c22b68ae8d1e80500709b0c0580776ad3", default-features = false }
dmi_id = { path = "../dmi-id" } dmi_id = { path = "../dmi-id" }
gumdrop.workspace = true gumdrop.workspace = true
@@ -31,36 +33,24 @@ env_logger.workspace = true
tokio.workspace = true tokio.workspace = true
serde.workspace = true serde.workspace = true
ron.workspace = true
serde_json.workspace = true
serde_derive.workspace = true serde_derive.workspace = true
zbus.workspace = true zbus.workspace = true
dirs.workspace = true dirs.workspace = true
notify-rust.workspace = true notify-rust.workspace = true
concat-idents.workspace = true concat-idents.workspace = true
png_pong.workspace = true
versions.workspace = true versions.workspace = true
nix = "^0.26.1"
tempfile = "3.3.0"
i-slint-backend-selector = { git = "https://github.com/slint-ui/slint.git" }
i-slint-core = { git = "https://github.com/slint-ui/slint.git" }
i-slint-backend-winit = { git = "https://github.com/slint-ui/slint.git" }
winit = "*"
[dependencies.slint] [dependencies.slint]
git = "https://github.com/slint-ui/slint.git" git = "https://github.com/slint-ui/slint.git"
default-features = false default-features = false
features = [ features = [
"std",
"gettext", "gettext",
"compat-1-0", "compat-1-2",
"backend-winit-wayland",
"backend-linuxkms", "backend-linuxkms",
"renderer-femtovg", "backend-winit-wayland",
"renderer-winit-femtovg",
# "renderer-skia-opengl",
] ]
[build-dependencies.slint-build] [build-dependencies.slint-build]
+13 -4
View File
@@ -7,11 +7,20 @@ fn main() {
// write_locales(); // write_locales();
let root = env!("CARGO_MANIFEST_DIR"); let root = env!("CARGO_MANIFEST_DIR");
let mut path = PathBuf::from_str(root).unwrap(); let mut main = PathBuf::from_str(root).unwrap();
path.push("ui/main_window.slint"); main.push("ui/main_window.slint");
let mut include = PathBuf::from_str(root).unwrap();
include.push("ui");
slint_build::print_rustc_flags().unwrap();
// slint_build::compile("ui/main_window.slint").unwrap();
slint_build::compile_with_config( slint_build::compile_with_config(
path, main,
CompilerConfiguration::new().with_style("cosmic-dark".into()), CompilerConfiguration::new()
// .embed_resources(EmbedResourcesKind::EmbedFiles)
.with_include_paths(vec![include])
.with_style("fluent-dark".into()),
) )
.unwrap(); .unwrap();
} }
+11 -11
View File
@@ -22,8 +22,6 @@ use rog_control_center::{
get_ipc_file, on_tmp_dir_exists, print_versions, MainWindow, QUIT_APP, SHOWING_GUI, SHOW_GUI, get_ipc_file, on_tmp_dir_exists, print_versions, MainWindow, QUIT_APP, SHOWING_GUI, SHOW_GUI,
}; };
use tokio::runtime::Runtime; use tokio::runtime::Runtime;
// use winit::monitor::VideoMode;
// use winit::window::{Fullscreen, WindowLevel};
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {
@@ -73,11 +71,6 @@ async fn main() -> Result<()> {
.format_timestamp(None) .format_timestamp(None)
.init(); .init();
// start tokio
let rt = Runtime::new().expect("Unable to create Runtime");
// Enter the runtime so that `tokio::spawn` is available immediately.
let _enter = rt.enter();
let supported_properties = match proxy.supported_properties() { let supported_properties = match proxy.supported_properties() {
Ok(s) => s, Ok(s) => s,
Err(_e) => { Err(_e) => {
@@ -117,13 +110,19 @@ async fn main() -> Result<()> {
let enable_tray_icon = config.enable_tray_icon; let enable_tray_icon = config.enable_tray_icon;
let startup_in_background = config.startup_in_background; let startup_in_background = config.startup_in_background;
let config = Arc::new(Mutex::new(config)); let config = Arc::new(Mutex::new(config));
start_notifications(config.clone())?;
// start tokio
let rt = Runtime::new().expect("Unable to create Runtime");
// Enter the runtime so that `tokio::spawn` is available immediately.
let _enter = rt.enter();
start_notifications(config.clone(), &rt)?;
if enable_tray_icon { if enable_tray_icon {
init_tray(supported_properties, config.clone()); init_tray(supported_properties, config.clone());
} }
thread_local! { pub static UI: std::cell::RefCell<Option<MainWindow>> = Default::default()}; thread_local! { pub static UI: std::cell::RefCell<Option<MainWindow>> = Default::default()};
i_slint_backend_selector::with_platform(|_| Ok(())).unwrap(); // i_slint_backend_selector::with_platform(|_| Ok(())).unwrap();
let mut do_once = !startup_in_background; let mut do_once = !startup_in_background;
@@ -159,7 +158,7 @@ async fn main() -> Result<()> {
sleep(Duration::from_millis(50)); sleep(Duration::from_millis(50));
let config_copy = config.clone(); let config_copy = config.clone();
i_slint_core::api::invoke_from_event_loop(move || { slint::invoke_from_event_loop(move || {
UI.with(|ui| { UI.with(|ui| {
let mut ui = ui.borrow_mut(); let mut ui = ui.borrow_mut();
if let Some(ui) = ui.as_mut() { if let Some(ui) = ui.as_mut() {
@@ -193,7 +192,7 @@ async fn main() -> Result<()> {
} }
} }
i_slint_core::api::invoke_from_event_loop(move || { slint::invoke_from_event_loop(move || {
UI.with(|ui| { UI.with(|ui| {
let mut ui = ui.take(); let mut ui = ui.take();
if let Some(ui) = ui.borrow_mut() { if let Some(ui) = ui.borrow_mut() {
@@ -208,6 +207,7 @@ async fn main() -> Result<()> {
}); });
slint::run_event_loop_until_quit().unwrap(); slint::run_event_loop_until_quit().unwrap();
rt.shutdown_background();
Ok(()) Ok(())
} }
+10 -5
View File
@@ -18,6 +18,8 @@ use serde::{Deserialize, Serialize};
use supergfxctl::actions::UserActionRequired as GfxUserAction; use supergfxctl::actions::UserActionRequired as GfxUserAction;
use supergfxctl::pci_device::{GfxMode, GfxPower}; use supergfxctl::pci_device::{GfxMode, GfxPower};
use supergfxctl::zbus_proxy::DaemonProxy as SuperProxy; use supergfxctl::zbus_proxy::DaemonProxy as SuperProxy;
use tokio::runtime::Runtime;
use tokio::task::JoinHandle;
use tokio::time::sleep; use tokio::time::sleep;
use zbus::export::futures_util::StreamExt; use zbus::export::futures_util::StreamExt;
@@ -44,10 +46,13 @@ impl Default for EnabledNotifications {
} }
} }
pub fn start_notifications(config: Arc<Mutex<Config>>) -> Result<()> { pub fn start_notifications(
config: Arc<Mutex<Config>>,
rt: &Runtime,
) -> Result<Vec<JoinHandle<()>>> {
// Setup the AC/BAT commands that will run on power status change // Setup the AC/BAT commands that will run on power status change
let config_copy = config.clone(); let config_copy = config.clone();
tokio::task::spawn_blocking(move || { let blocking = rt.spawn_blocking(move || {
let power = AsusPower::new() let power = AsusPower::new()
.map_err(|e| { .map_err(|e| {
error!("AsusPower: {e}"); error!("AsusPower: {e}");
@@ -61,8 +66,8 @@ pub fn start_notifications(config: Arc<Mutex<Config>>) -> Result<()> {
let mut ac = String::new(); let mut ac = String::new();
let mut bat = String::new(); let mut bat = String::new();
if let Ok(config) = config_copy.lock() { if let Ok(config) = config_copy.lock() {
ac = config.ac_command.clone(); ac.clone_from(&config.ac_command);
bat = config.bat_command.clone(); bat.clone_from(&config.bat_command);
} }
if p == 0 && p != last_state { if p == 0 && p != last_state {
@@ -217,7 +222,7 @@ pub fn start_notifications(config: Arc<Mutex<Config>>) -> Result<()> {
}; };
}); });
Ok(()) Ok(vec![blocking])
} }
fn convert_gfx_mode(gfx: GfxMode) -> GpuMode { fn convert_gfx_mode(gfx: GfxMode) -> GpuMode {
+36 -28
View File
@@ -136,7 +136,11 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
.with_tooltip(TRAY_LABEL) .with_tooltip(TRAY_LABEL)
.with_menu(build_menu()) .with_menu(build_menu())
.build(do_action) .build(do_action)
.map_err(|e| log::error!("Tray unable to be initialised: {e:?}")) .map_err(|e| {
log::error!(
"Tray unable to be initialised: {e:?}. Do you have a system tray enabled?"
)
})
{ {
info!("Tray started"); info!("Tray started");
let rog_blue = read_icon(&PathBuf::from("asus_notif_blue.png")); let rog_blue = read_icon(&PathBuf::from("asus_notif_blue.png"));
@@ -151,41 +155,45 @@ pub fn init_tray(_supported_properties: Vec<Properties>, config: Arc<Mutex<Confi
gpu_integrated, gpu_integrated,
}); });
let mut has_supergfx = true;
let conn = zbus::blocking::Connection::system().unwrap(); let conn = zbus::blocking::Connection::system().unwrap();
let gfx_proxy = GfxProxy::new(&conn).unwrap(); if let Ok(gfx_proxy) = GfxProxy::new(&conn) {
let mut supergfx_active = false; let mut supergfx_active = false;
if gfx_proxy.mode().is_ok() { if gfx_proxy.mode().is_ok() {
supergfx_active = true; supergfx_active = true;
if let Ok(version) = gfx_proxy.version() { if let Ok(version) = gfx_proxy.version() {
if let Some(version) = Versioning::new(&version) { if let Some(version) = Versioning::new(&version) {
let curr_gfx = Versioning::new("5.0.3-RC4").unwrap(); let curr_gfx = Versioning::new("5.2.0").unwrap();
warn!("supergfxd version = {version}"); warn!("supergfxd version = {version}");
if version < curr_gfx { if version < curr_gfx {
// Don't allow mode changing if too old a version // Don't allow mode changing if too old a version
warn!("supergfxd found but is too old to use"); warn!("supergfxd found but is too old to use");
// tray.gfx_proxy_is_active = false; has_supergfx = false;
}
} }
} }
} };
};
info!("Started ROGTray"); info!("Started ROGTray");
let mut last_power = GfxPower::Unknown; let mut last_power = GfxPower::Unknown;
loop { loop {
if let Ok(lock) = config.try_lock() { sleep(Duration::from_millis(1000));
if !lock.enable_tray_icon { if let Ok(lock) = config.try_lock() {
return; if !lock.enable_tray_icon {
return;
}
} }
} if has_supergfx {
if let Ok(mode) = gfx_proxy.mode() { if let Ok(mode) = gfx_proxy.mode() {
if let Ok(power) = gfx_proxy.power() { if let Ok(power) = gfx_proxy.power() {
if last_power != power { if last_power != power {
set_tray_icon_and_tip(mode, power, &mut tray, supergfx_active); set_tray_icon_and_tip(mode, power, &mut tray, supergfx_active);
last_power = power; last_power = power;
}
}
} }
} }
} }
sleep(Duration::from_millis(500));
} }
} }
}); });
+1 -3
View File
@@ -63,8 +63,7 @@ impl From<PowerZones> for SlintPowerZones {
PowerZones::Lightbar => SlintPowerZones::Lightbar, PowerZones::Lightbar => SlintPowerZones::Lightbar,
PowerZones::Lid => SlintPowerZones::Lid, PowerZones::Lid => SlintPowerZones::Lid,
PowerZones::RearGlow => SlintPowerZones::RearGlow, PowerZones::RearGlow => SlintPowerZones::RearGlow,
PowerZones::KeyboardAndLightbar => todo!(), PowerZones::None => SlintPowerZones::Keyboard,
PowerZones::None => todo!(),
} }
} }
} }
@@ -77,7 +76,6 @@ impl From<SlintPowerZones> for PowerZones {
SlintPowerZones::Lightbar => PowerZones::Lightbar, SlintPowerZones::Lightbar => PowerZones::Lightbar,
SlintPowerZones::Lid => PowerZones::Lid, SlintPowerZones::Lid => PowerZones::Lid,
SlintPowerZones::RearGlow => PowerZones::RearGlow, SlintPowerZones::RearGlow => PowerZones::RearGlow,
SlintPowerZones::KeyboardAndLightbar => PowerZones::KeyboardAndLightbar,
} }
} }
} }
+6 -12
View File
@@ -6,12 +6,12 @@ pub mod setup_system;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use config_traits::StdConfig; use config_traits::StdConfig;
use rog_dbus::zbus_platform::PlatformProxyBlocking; use rog_dbus::has_iface_blocking;
use slint::{ComponentHandle, PhysicalSize, SharedString, Weak}; use slint::{ComponentHandle, PhysicalSize, SharedString, Weak};
use crate::config::Config; use crate::config::Config;
use crate::ui::setup_anime::setup_anime_page; use crate::ui::setup_anime::setup_anime_page;
use crate::ui::setup_aura::{has_aura_iface_blocking, setup_aura_page}; use crate::ui::setup_aura::setup_aura_page;
use crate::ui::setup_fans::setup_fan_curve_page; use crate::ui::setup_fans::setup_fan_curve_page;
use crate::ui::setup_system::{setup_system_page, setup_system_page_callbacks}; use crate::ui::setup_system::{setup_system_page, setup_system_page_callbacks};
use crate::{AppSettingsPageData, MainWindow}; use crate::{AppSettingsPageData, MainWindow};
@@ -108,19 +108,13 @@ pub fn setup_window(config: Arc<Mutex<Config>>) -> MainWindow {
} }
}; };
let conn = zbus::blocking::Connection::system().unwrap();
let platform = PlatformProxyBlocking::new(&conn).unwrap();
let interfaces = platform.supported_interfaces().unwrap();
log::debug!("Available interfaces: {interfaces:?}");
// "Anime", "Aura", "FanCurves", "Platform"
ui.set_sidebar_items_avilable( ui.set_sidebar_items_avilable(
[ [
// Needs to match the order of slint sidebar items // Needs to match the order of slint sidebar items
interfaces.contains(&"Platform".into()), has_iface_blocking("org.asuslinux.Platform").unwrap_or(false),
has_aura_iface_blocking().unwrap_or(false), has_iface_blocking("org.asuslinux.Aura").unwrap_or(false),
interfaces.contains(&"Anime".into()), has_iface_blocking("org.asuslinux.Anime").unwrap_or(false),
interfaces.contains(&"FanCurves".into()), has_iface_blocking("org.asuslinux.FanCurves").unwrap_or(false),
true, true,
true, true,
] ]
+10 -3
View File
@@ -1,5 +1,6 @@
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use log::{error, info, warn};
use rog_anime::Animations; use rog_anime::Animations;
use rog_dbus::zbus_anime::AnimeProxy; use rog_dbus::zbus_anime::AnimeProxy;
use slint::ComponentHandle; use slint::ComponentHandle;
@@ -11,8 +12,13 @@ use crate::{set_ui_callbacks, set_ui_props_async, AnimePageData, MainWindow};
pub fn setup_anime_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) { pub fn setup_anime_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
let handle = ui.as_weak(); let handle = ui.as_weak();
tokio::spawn(async move { tokio::spawn(async move {
let conn = zbus::Connection::system().await.unwrap(); let Ok(conn) = zbus::Connection::system().await.map_err(|e| warn!("{e:}")) else {
let anime = AnimeProxy::new(&conn).await.unwrap(); return;
};
let Ok(anime) = AnimeProxy::new(&conn).await.map_err(|e| warn!("{e:}")) else {
info!("This device may not have an AniMe. If not then the error can be ignored");
return;
};
set_ui_props_async!(handle, anime, AnimePageData, brightness); set_ui_props_async!(handle, anime, AnimePageData, brightness);
set_ui_props_async!(handle, anime, AnimePageData, builtins_enabled); set_ui_props_async!(handle, anime, AnimePageData, builtins_enabled);
@@ -123,6 +129,7 @@ pub fn setup_anime_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
"Setting Anime off_when_unplugged failed" "Setting Anime off_when_unplugged failed"
); );
}) })
.unwrap(); .map_err(|e| error!("setup_anime_page: upgrade_in_event_loop: {e:?}"))
.ok();
}); });
} }
+10 -23
View File
@@ -1,5 +1,6 @@
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use log::{error, info};
use rog_aura::keyboard::LaptopAuraPower; use rog_aura::keyboard::LaptopAuraPower;
use rog_dbus::zbus_aura::AuraProxy; use rog_dbus::zbus_aura::AuraProxy;
use slint::{ComponentHandle, Model, RgbaColor, SharedString}; use slint::{ComponentHandle, Model, RgbaColor, SharedString};
@@ -32,31 +33,11 @@ fn decode_hex(s: &str) -> RgbaColor<u8> {
} }
} }
pub fn has_aura_iface_blocking() -> Result<bool, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system()?;
let f = zbus::blocking::fdo::ObjectManagerProxy::new(
&conn,
"org.asuslinux.Daemon",
"/org/asuslinux",
)?;
let interfaces = f.get_managed_objects()?;
let mut aura_paths = Vec::new();
for v in interfaces.iter() {
for k in v.1.keys() {
if k.as_str() == "org.asuslinux.Aura" {
aura_paths.push(v.0.clone());
}
}
}
Ok(!aura_paths.is_empty())
}
/// Returns the first available Aura interface /// Returns the first available Aura interface
// TODO: return all // TODO: return all
async fn find_aura_iface() -> Result<AuraProxy<'static>, Box<dyn std::error::Error>> { async fn find_aura_iface() -> Result<AuraProxy<'static>, Box<dyn std::error::Error>> {
let conn = zbus::Connection::system().await?; let conn = zbus::Connection::system().await?;
let f = let f = zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/").await?;
zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/org/asuslinux").await?;
let interfaces = f.get_managed_objects().await?; let interfaces = f.get_managed_objects().await?;
let mut aura_paths = Vec::new(); let mut aura_paths = Vec::new();
for v in interfaces.iter() { for v in interfaces.iter() {
@@ -92,7 +73,10 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
let handle = ui.as_weak(); let handle = ui.as_weak();
tokio::spawn(async move { tokio::spawn(async move {
let aura = find_aura_iface().await.unwrap(); let Ok(aura) = find_aura_iface().await else {
info!("This device appears to have no aura interfaces");
return;
};
set_ui_props_async!(handle, aura, AuraPageData, brightness); set_ui_props_async!(handle, aura, AuraPageData, brightness);
set_ui_props_async!(handle, aura, AuraPageData, led_mode); set_ui_props_async!(handle, aura, AuraPageData, led_mode);
@@ -132,6 +116,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
.global::<AuraPageData>() .global::<AuraPageData>()
.set_available_mode_names(res.as_slice().into()); .set_available_mode_names(res.as_slice().into());
}) })
.map_err(|e| error!("{e:}"))
.ok(); .ok();
} }
@@ -190,7 +175,8 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
}); });
}); });
}) })
.unwrap(); .map_err(|e| error!("{e:}"))
.ok();
// Need to update the UI if the mode changes // Need to update the UI if the mode changes
let handle_copy = handle.clone(); let handle_copy = handle.clone();
@@ -207,6 +193,7 @@ pub fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
.invoke_update_led_mode_data(out.into()); .invoke_update_led_mode_data(out.into());
handle.invoke_external_colour_change(); handle.invoke_external_colour_change();
}) })
.map_err(|e| error!("{e:}"))
.ok(); .ok();
} }
} }
+64 -15
View File
@@ -1,5 +1,6 @@
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use log::{error, info};
use rog_dbus::zbus_fan_curves::FanCurvesProxy; use rog_dbus::zbus_fan_curves::FanCurvesProxy;
use rog_platform::platform::ThrottlePolicy; use rog_platform::platform::ThrottlePolicy;
use rog_profiles::fan_curve_set::CurveData; use rog_profiles::fan_curve_set::CurveData;
@@ -81,7 +82,8 @@ pub fn update_fan_data(
} }
} }
}) })
.unwrap(); .map_err(|e| error!("update_fan_data: upgrade_in_event_loop: {e:?}"))
.ok();
} }
pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) { pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
@@ -89,17 +91,44 @@ pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
tokio::spawn(async move { tokio::spawn(async move {
// Create the connections/proxies here to prevent future delays in process // Create the connections/proxies here to prevent future delays in process
let conn = zbus::Connection::system().await.unwrap(); let conn = if let Ok(conn) = zbus::Connection::system().await.map_err(|e| error!("{e:}")) {
let fans = FanCurvesProxy::new(&conn).await.unwrap(); conn
} else {
return;
};
let fans = if let Ok(fans) = FanCurvesProxy::new(&conn).await.map_err(|e| error!("{e:}")) {
fans
} else {
info!(
"This device may not have an Fan Curve control. If not then the error can be \
ignored"
);
return;
};
let handle_copy = handle.clone(); let handle_copy = handle.clone();
// Do initial setup // Do initial setup
let balanced = fans.fan_curve_data(ThrottlePolicy::Balanced).await.unwrap(); let Ok(balanced) = fans
let perf = fans .fan_curve_data(ThrottlePolicy::Balanced)
.await
.map_err(|e| error!("{e:}"))
else {
return;
};
let Ok(perf) = fans
.fan_curve_data(ThrottlePolicy::Performance) .fan_curve_data(ThrottlePolicy::Performance)
.await .await
.unwrap(); .map_err(|e| error!("{e:}"))
let quiet = fans.fan_curve_data(ThrottlePolicy::Quiet).await.unwrap(); else {
return;
};
let Ok(quiet) = fans
.fan_curve_data(ThrottlePolicy::Quiet)
.await
.map_err(|e| error!("{e:}"))
else {
return;
};
update_fan_data(handle, balanced, perf, quiet); update_fan_data(handle, balanced, perf, quiet);
let handle_next1 = handle_copy.clone(); let handle_next1 = handle_copy.clone();
@@ -111,14 +140,30 @@ pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
let fans = fans1.clone(); let fans = fans1.clone();
let handle_next = handle_next1.clone(); let handle_next = handle_next1.clone();
tokio::spawn(async move { tokio::spawn(async move {
fans.set_curves_to_defaults(profile.into()).await.unwrap(); if fans.set_curves_to_defaults(profile.into()).await.is_err() {
return;
let balanced = fans.fan_curve_data(ThrottlePolicy::Balanced).await.unwrap(); }
let perf = fans let Ok(balanced) = fans
.fan_curve_data(ThrottlePolicy::Balanced)
.await
.map_err(|e| error!("{e:}"))
else {
return;
};
let Ok(perf) = fans
.fan_curve_data(ThrottlePolicy::Performance) .fan_curve_data(ThrottlePolicy::Performance)
.await .await
.unwrap(); .map_err(|e| error!("{e:}"))
let quiet = fans.fan_curve_data(ThrottlePolicy::Quiet).await.unwrap(); else {
return;
};
let Ok(quiet) = fans
.fan_curve_data(ThrottlePolicy::Quiet)
.await
.map_err(|e| error!("{e:}"))
else {
return;
};
update_fan_data(handle_next, balanced, perf, quiet); update_fan_data(handle_next, balanced, perf, quiet);
}); });
}); });
@@ -127,11 +172,15 @@ pub fn setup_fan_curve_page(ui: &MainWindow, _config: Arc<Mutex<Config>>) {
let data: Vec<Node> = data.iter().collect(); let data: Vec<Node> = data.iter().collect();
let data = fan_data_for(fan, enabled, data); let data = fan_data_for(fan, enabled, data);
tokio::spawn(async move { tokio::spawn(async move {
fans.set_fan_curve(profile.into(), data).await.unwrap(); fans.set_fan_curve(profile.into(), data)
.await
.map_err(|e| error!("{e:}"))
.ok()
}); });
}); });
}) })
.unwrap(); .map_err(|e| error!("setup_fan_curve_page: upgrade_in_event_loop: {e:?}"))
.ok();
}); });
} }
@@ -2,7 +2,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-05-05 08:22+0000\n" "POT-Creation-Date: 2024-05-09 22:04+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -422,192 +422,192 @@ msgctxt "AuraPowerGroup"
msgid "Shutdown" msgid "Shutdown"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:46 #: rog-control-center/ui/types/aura_types.slint:45
msgctxt "Aura power zone" msgctxt "Aura power zone"
msgid "Logo" msgid "Logo"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:47 #: rog-control-center/ui/types/aura_types.slint:46
msgctxt "Aura power zone" msgctxt "Aura power zone"
msgid "Keyboard" msgid "Keyboard"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:48 #: rog-control-center/ui/types/aura_types.slint:47
msgctxt "Aura power zone" msgctxt "Aura power zone"
msgid "Lightbar" msgid "Lightbar"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:49 #: rog-control-center/ui/types/aura_types.slint:48
msgctxt "Aura power zone" msgctxt "Aura power zone"
msgid "Lid" msgid "Lid"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:50 #: rog-control-center/ui/types/aura_types.slint:49
msgctxt "Aura power zone" msgctxt "Aura power zone"
msgid "Rear Glow" msgid "Rear Glow"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:51 #: rog-control-center/ui/types/aura_types.slint:50
msgctxt "Aura power zone" msgctxt "Aura power zone"
msgid "Keyboard and Lightbar" msgid "Keyboard and Lightbar"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:54 #: rog-control-center/ui/types/aura_types.slint:53
msgctxt "Aura brightness" msgctxt "Aura brightness"
msgid "Off" msgid "Off"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:55 #: rog-control-center/ui/types/aura_types.slint:54
msgctxt "Aura brightness" msgctxt "Aura brightness"
msgid "Low" msgid "Low"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:56 #: rog-control-center/ui/types/aura_types.slint:55
msgctxt "Aura brightness" msgctxt "Aura brightness"
msgid "Med" msgid "Med"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:57 #: rog-control-center/ui/types/aura_types.slint:56
msgctxt "Aura brightness" msgctxt "Aura brightness"
msgid "High" msgid "High"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:62 rog-control-center/ui/types/aura_types.slint:77 #: rog-control-center/ui/types/aura_types.slint:61 rog-control-center/ui/types/aura_types.slint:76
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Static" msgid "Static"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:63 rog-control-center/ui/types/aura_types.slint:78 #: rog-control-center/ui/types/aura_types.slint:62 rog-control-center/ui/types/aura_types.slint:77
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Breathe" msgid "Breathe"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:64 rog-control-center/ui/types/aura_types.slint:79 #: rog-control-center/ui/types/aura_types.slint:63 rog-control-center/ui/types/aura_types.slint:78
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Strobe" msgid "Strobe"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:65 #: rog-control-center/ui/types/aura_types.slint:64
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Rainbow" msgid "Rainbow"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:66 #: rog-control-center/ui/types/aura_types.slint:65
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Star" msgid "Star"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:67 #: rog-control-center/ui/types/aura_types.slint:66
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Rain" msgid "Rain"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:68 #: rog-control-center/ui/types/aura_types.slint:67
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Highlight" msgid "Highlight"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:69 #: rog-control-center/ui/types/aura_types.slint:68
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Laser" msgid "Laser"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:70 #: rog-control-center/ui/types/aura_types.slint:69
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Ripple" msgid "Ripple"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:71 #: rog-control-center/ui/types/aura_types.slint:70
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Nothing" msgid "Nothing"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:72 #: rog-control-center/ui/types/aura_types.slint:71
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Pulse" msgid "Pulse"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:73 #: rog-control-center/ui/types/aura_types.slint:72
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Comet" msgid "Comet"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:74 #: rog-control-center/ui/types/aura_types.slint:73
msgctxt "Basic aura mode" msgctxt "Basic aura mode"
msgid "Flash" msgid "Flash"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:86 #: rog-control-center/ui/types/aura_types.slint:85
msgctxt "Aura zone" msgctxt "Aura zone"
msgid "None" msgid "None"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:87 #: rog-control-center/ui/types/aura_types.slint:86
msgctxt "Aura zone" msgctxt "Aura zone"
msgid "Key1" msgid "Key1"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:88 #: rog-control-center/ui/types/aura_types.slint:87
msgctxt "Aura zone" msgctxt "Aura zone"
msgid "Key2" msgid "Key2"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:89 #: rog-control-center/ui/types/aura_types.slint:88
msgctxt "Aura zone" msgctxt "Aura zone"
msgid "Key3" msgid "Key3"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:90 #: rog-control-center/ui/types/aura_types.slint:89
msgctxt "Aura zone" msgctxt "Aura zone"
msgid "Key4" msgid "Key4"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:91 #: rog-control-center/ui/types/aura_types.slint:90
msgctxt "Aura zone" msgctxt "Aura zone"
msgid "Logo" msgid "Logo"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:92 #: rog-control-center/ui/types/aura_types.slint:91
msgctxt "Aura zone" msgctxt "Aura zone"
msgid "Lightbar Left" msgid "Lightbar Left"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:93 #: rog-control-center/ui/types/aura_types.slint:92
msgctxt "Aura zone" msgctxt "Aura zone"
msgid "Lightbar Right" msgid "Lightbar Right"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:97 #: rog-control-center/ui/types/aura_types.slint:96
msgctxt "Aura direction" msgctxt "Aura direction"
msgid "Right" msgid "Right"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:98 #: rog-control-center/ui/types/aura_types.slint:97
msgctxt "Aura direction" msgctxt "Aura direction"
msgid "Left" msgid "Left"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:99 #: rog-control-center/ui/types/aura_types.slint:98
msgctxt "Aura direction" msgctxt "Aura direction"
msgid "Up" msgid "Up"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:100 #: rog-control-center/ui/types/aura_types.slint:99
msgctxt "Aura direction" msgctxt "Aura direction"
msgid "Down" msgid "Down"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:104 #: rog-control-center/ui/types/aura_types.slint:103
msgctxt "Aura speed" msgctxt "Aura speed"
msgid "Low" msgid "Low"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:105 #: rog-control-center/ui/types/aura_types.slint:104
msgctxt "Aura speed" msgctxt "Aura speed"
msgid "Medium" msgid "Medium"
msgstr "" msgstr ""
#: rog-control-center/ui/types/aura_types.slint:106 #: rog-control-center/ui/types/aura_types.slint:105
msgctxt "Aura speed" msgctxt "Aura speed"
msgid "High" msgid "High"
msgstr "" msgstr ""
@@ -25,7 +25,6 @@ export enum PowerZones {
Lightbar, Lightbar,
Lid, Lid,
RearGlow, RearGlow,
KeyboardAndLightbar
} }
export struct AuraPowerState { export struct AuraPowerState {
@@ -6,6 +6,7 @@ export component ColourSlider inherits VerticalLayout {
property <string> hex: "#FF0000"; property <string> hex: "#FF0000";
in-out property <float> c1value <=> c1.value; in-out property <float> c1value <=> c1.value;
in-out property <float> c2value <=> c2.value; in-out property <float> c2value <=> c2.value;
in-out property <float> c3value <=> c3.value;
property <color> base_colour: Colors.red; property <color> base_colour: Colors.red;
in-out property <color> final_colour: Colors.red; in-out property <color> final_colour: Colors.red;
in-out property <brush> colourbox: final_colour; in-out property <brush> colourbox: final_colour;
@@ -53,39 +54,52 @@ export component ColourSlider inherits VerticalLayout {
hsv(350, 1, 1), hsv(350, 1, 1),
hsv(360, 1, 1), hsv(360, 1, 1),
]; ];
property <[color]> base_shade: [ property <[color]> base_saturation: [
blend_lightness(base_colour, 1.0), hsv(base_colour.to-hsv().hue, 1, 1),
blend_lightness(base_colour, 0.9), hsv(base_colour.to-hsv().hue, 0.9, 1),
blend_lightness(base_colour, 0.8), hsv(base_colour.to-hsv().hue, 0.8, 1),
blend_lightness(base_colour, 0.7), hsv(base_colour.to-hsv().hue, 0.7, 1),
blend_lightness(base_colour, 0.6), hsv(base_colour.to-hsv().hue, 0.6, 1),
blend_lightness(base_colour, 0.5), hsv(base_colour.to-hsv().hue, 0.5, 1),
blend_lightness(base_colour, 0.4), hsv(base_colour.to-hsv().hue, 0.4, 1),
blend_lightness(base_colour, 0.3), hsv(base_colour.to-hsv().hue, 0.3, 1),
blend_lightness(base_colour, 0.2), hsv(base_colour.to-hsv().hue, 0.2, 1),
blend_lightness(base_colour, 0.1), hsv(base_colour.to-hsv().hue, 0.1, 1),
blend_lightness(base_colour, 0.0) hsv(base_colour.to-hsv().hue, 0, 1),
]; ];
function blend_lightness(c1: color,f: float) -> color { property <[color]> base_value: [
rgb(c1.red * f, c1.green * f, c1.blue * f) hsv(base_colour.to-hsv().hue, 1, 1),
} hsv(base_colour.to-hsv().hue, 1, 0.9),
// hsv(base_colour.to-hsv().hue, 1, 0.8),
hsv(base_colour.to-hsv().hue, 1, 0.7),
hsv(base_colour.to-hsv().hue, 1, 0.6),
hsv(base_colour.to-hsv().hue, 1, 0.5),
hsv(base_colour.to-hsv().hue, 1, 0.4),
hsv(base_colour.to-hsv().hue, 1, 0.3),
hsv(base_colour.to-hsv().hue, 1, 0.2),
hsv(base_colour.to-hsv().hue, 1, 0.1),
hsv(base_colour.to-hsv().hue, 1, 0),
];
function set_base_colour(){ function set_base_colour(){
root.base_colour = base_colours[c1.value].mix(base_colours[c1.value + 1], c1.value - Math.floor(c1.value)); root.base_colour = hsv(c1.value / base_colours.length * 360, 1, 1);
root.final_colour = blend_lightness(base_colour, ((base_shade.length - c2.value) / base_shade.length)); root.final_colour = hsv(base_colour.to-hsv().hue, ((base_saturation.length - c2.value) / base_saturation.length), ((base_value.length - c3.value) / base_value.length));
root.colourbox = root.final_colour; root.colourbox = root.final_colour;
} }
//
callback external_colour_change(); callback external_colour_change();
external_colour_change => { external_colour_change => {
if (root.final_colour.to-hsv().hue < 0) { if (root.final_colour.to-hsv().hue < 0) {
c1.value = (root.base_colours.length - 1) * ((root.final_colour.to-hsv().hue + 360) / 360); c1.value = root.base_colours.length * (root.final_colour.to-hsv().hue + 360) / 360;
} else { } else {
c1.value = (root.base_colours.length - 1) * (root.final_colour.to-hsv().hue / 360); c1.value = root.base_colours.length * root.final_colour.to-hsv().hue / 360;
} }
c2.value = root.base_shade.length - (root.base_shade.length * root.final_colour.to-hsv().value); // c1.value = root.base_colours.length * 360 / root.final_colour.to-hsv().hue;
c2.value = root.base_saturation.length - root.base_saturation.length * root.final_colour.to-hsv().saturation;
c3.value = root.base_value.length - root.base_value.length * root.final_colour.to-hsv().value;
root.set_base_colour(); root.set_base_colour();
hex = set_hex_from_colour(final_colour);
} }
Rectangle { Rectangle {
height: 32px; height: 32px;
@@ -100,7 +114,7 @@ export component ColourSlider inherits VerticalLayout {
width: parent.width; width: parent.width;
height: parent.height; height: parent.height;
minimum: 0; minimum: 0;
maximum: root.base_colours.length - 1; maximum: root.base_colours.length;
// One less than the array length // One less than the array length
changed => { changed => {
set_base_colour(); set_base_colour();
@@ -118,14 +132,38 @@ export component ColourSlider inherits VerticalLayout {
border-radius: 7px; border-radius: 7px;
border-color: Palette.border; border-color: Palette.border;
// 11 colours // 11 colours
background: !root.enabled ? Palette.alternate-background : @linear-gradient(90deg, base_shade[0], base_shade[1], base_shade[2], base_shade[3], base_shade[4], base_shade[5], base_shade[6], base_shade[7], base_shade[8], base_shade[9], base_shade[10]); background: !root.enabled ? Palette.alternate-background : @linear-gradient(90deg, base_saturation[0], base_saturation[1], base_saturation[2], base_saturation[3], base_saturation[4], base_saturation[5], base_saturation[6], base_saturation[7], base_saturation[8], base_saturation[9], base_saturation[10]);
clip: true; clip: true;
c2 := Slider { c2 := Slider {
enabled <=> root.enabled; enabled <=> root.enabled;
width: parent.width; width: parent.width;
height: parent.height; height: parent.height;
minimum: 0; minimum: 0;
maximum: 11; maximum: root.base_saturation.length;
changed => {
set_base_colour();
hex = set_hex_from_colour(final_colour);
}
released => {
root.released();
}
}
}
Rectangle {
height: 32px;
border-width: 2px;
border-radius: 7px;
border-color: Palette.border;
// 11 colours
background: !root.enabled ? Palette.alternate-background : @linear-gradient(90deg, base_value[0], base_value[1], base_value[2], base_value[3], base_value[4], base_value[5], base_value[6], base_value[7], base_value[8], base_value[9], base_value[10]);
clip: true;
c3 := Slider {
enabled <=> root.enabled;
width: parent.width;
height: parent.height;
minimum: 0;
maximum: root.base_value.length;
changed => { changed => {
set_base_colour(); set_base_colour();
hex = set_hex_from_colour(final_colour); hex = set_hex_from_colour(final_colour);
+7 -7
View File
@@ -1,13 +1,13 @@
[package] [package]
name = "rog_dbus" name = "rog_dbus"
license.workspace = true
version.workspace = true version.workspace = true
license = "MPL-2.0" readme.workspace = true
readme = "README.md" authors.workspace = true
authors = ["Luke <luke@ljones.dev>"] repository.workspace = true
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl" homepage.workspace = true
homepage = "https://gitlab.com/asus-linux/asus-nb-ctrl" edition.workspace = true
description = "dbus interface methods for asusctl" description = "dbus interface methods for asusctl"
edition = "2021"
[dependencies] [dependencies]
asusd = { path = "../asusd" } asusd = { path = "../asusd" }
@@ -19,4 +19,4 @@ rog_platform = { path = "../rog-platform" }
zbus.workspace = true zbus.workspace = true
[dev-dependencies] [dev-dependencies]
cargo-husky.workspace = true cargo-husky.workspace = true
+41
View File
@@ -7,3 +7,44 @@ pub mod zbus_platform;
pub mod zbus_slash; pub mod zbus_slash;
pub const VERSION: &str = env!("CARGO_PKG_VERSION"); pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn list_iface_blocking() -> Result<Vec<String>, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system()?;
let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/")?;
let interfaces = f.get_managed_objects()?;
let mut ifaces = Vec::new();
for v in interfaces.iter() {
for k in v.1.keys() {
ifaces.push(k.to_string());
}
}
Ok(ifaces)
}
pub fn has_iface_blocking(iface: &str) -> Result<bool, Box<dyn std::error::Error>> {
let conn = zbus::blocking::Connection::system()?;
let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/")?;
let interfaces = f.get_managed_objects()?;
for v in interfaces.iter() {
for k in v.1.keys() {
if k.as_str() == iface {
return Ok(true);
}
}
}
Ok(false)
}
pub async fn has_iface(iface: &str) -> Result<bool, Box<dyn std::error::Error>> {
let conn = zbus::Connection::system().await?;
let f = zbus::fdo::ObjectManagerProxy::new(&conn, "org.asuslinux.Daemon", "/").await?;
let interfaces = f.get_managed_objects().await?;
for v in interfaces.iter() {
for k in v.1.keys() {
if k.as_str() == iface {
return Ok(true);
}
}
}
Ok(false)
}
-3
View File
@@ -36,9 +36,6 @@ trait Platform {
/// NextThrottleThermalPolicy method /// NextThrottleThermalPolicy method
fn next_throttle_thermal_policy(&self) -> zbus::Result<()>; fn next_throttle_thermal_policy(&self) -> zbus::Result<()>;
/// SupportedInterfaces method
fn supported_interfaces(&self) -> zbus::Result<Vec<String>>;
/// SupportedProperties method /// SupportedProperties method
fn supported_properties(&self) -> zbus::Result<Vec<Properties>>; fn supported_properties(&self) -> zbus::Result<Vec<Properties>>;
+6 -4
View File
@@ -1,13 +1,16 @@
[package] [package]
name = "rog_platform" name = "rog_platform"
license = "MPL-2.0" license.workspace = true
version.workspace = true version.workspace = true
edition = "2021" readme.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
[dependencies] [dependencies]
log.workspace = true log.workspace = true
serde.workspace = true serde.workspace = true
serde_derive.workspace = true
zbus.workspace = true zbus.workspace = true
concat-idents.workspace = true concat-idents.workspace = true
udev.workspace = true udev.workspace = true
@@ -18,4 +21,3 @@ rusb.workspace = true
[dev-dependencies] [dev-dependencies]
cargo-husky.workspace = true cargo-husky.workspace = true
rog_aura = { path = "../rog-aura" }
+6 -3
View File
@@ -5,12 +5,15 @@ use log::{info, warn};
use crate::error::{PlatformError, Result}; use crate::error::{PlatformError, Result};
use crate::{attr_u8, has_attr, set_attr_u8_array, to_device}; use crate::{attr_u8, has_attr, set_attr_u8_array, to_device};
/// The sysfs control for backlight levels. This is only for the 3-step
/// backlight setting, and for TUF laptops. It is not a hard requirement
/// for Aura keyboards
#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Clone)] #[derive(Debug, Default, PartialEq, Eq, PartialOrd, Clone)]
pub struct KeyboardLed { pub struct KeyboardBacklight {
path: PathBuf, path: PathBuf,
} }
impl KeyboardLed { impl KeyboardBacklight {
attr_u8!("brightness", path); attr_u8!("brightness", path);
has_attr!("kbd_rgb_mode" path); has_attr!("kbd_rgb_mode" path);
@@ -59,7 +62,7 @@ impl KeyboardLed {
}); });
} }
Err(PlatformError::MissingFunction( Err(PlatformError::MissingFunction(
"asus::kbd_backlight not found".into(), "KeyboardLed:new(), asus::kbd_backlight not found".into(),
)) ))
} }
} }
+3 -4
View File
@@ -60,13 +60,12 @@ impl AsusPower {
info!("Found a battery"); info!("Found a battery");
if battery.is_none() { if battery.is_none() {
info!("Checking battery attributes"); info!("Checking battery attributes");
if device if let Some(current) =
.attribute_value("charge_control_end_threshold") device.attribute_value("charge_control_end_threshold")
.is_some()
{ {
info!( info!(
"Found battery power at {:?}, matched \ "Found battery power at {:?}, matched \
charge_control_end_threshold", charge_control_end_threshold. Current level: {current:?}",
device.sysname() device.sysname()
); );
battery = Some(device.syspath().to_path_buf()); battery = Some(device.syspath().to_path_buf());
+1 -1
View File
@@ -27,7 +27,7 @@ impl USBRaw {
device: &Device<rusb::GlobalContext>, device: &Device<rusb::GlobalContext>,
) -> Result<DeviceHandle<rusb::GlobalContext>> { ) -> Result<DeviceHandle<rusb::GlobalContext>> {
// We don't expect this ID to ever change // We don't expect this ID to ever change
let mut device = device.open()?; let device = device.open()?;
device.reset()?; device.reset()?;
device.set_auto_detach_kernel_driver(true)?; device.set_auto_detach_kernel_driver(true)?;
device.claim_interface(0)?; device.claim_interface(0)?;
+10 -4
View File
@@ -1,9 +1,12 @@
[package] [package]
name = "rog_profiles" name = "rog_profiles"
license = "MPL-2.0" license.workspace = true
version.workspace = true version.workspace = true
authors = ["Luke D. Jones <luke@ljones.dev>"] readme.workspace = true
edition = "2021" authors.workspace = true
repository.workspace = true
homepage.workspace = true
edition.workspace = true
[features] [features]
default = ["dbus"] default = ["dbus"]
@@ -20,4 +23,7 @@ rog_platform = { path = "../rog-platform" }
zbus = { workspace = true, optional = true } zbus = { workspace = true, optional = true }
[dev-dependencies] [dev-dependencies]
cargo-husky.workspace = true cargo-husky.workspace = true
[package.metadata.cargo-machete]
ignored = ["serde"]
+10 -15
View File
@@ -1,14 +1,15 @@
[package] [package]
name = "rog_slash" name = "rog_slash"
license = "MPL-2.0" license.workspace = true
version.workspace = true version.workspace = true
authors = ["Luke <luke@ljones.dev>"] readme.workspace = true
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl" authors.workspace = true
homepage = "https://gitlab.com/asus-linux/asus-nb-ctrl" repository.workspace = true
homepage.workspace = true
edition.workspace = true
documentation = "https://docs.rs/rog-slash" documentation = "https://docs.rs/rog-slash"
description = "ASUS Slash display" description = "ASUS Slash display"
keywords = ["ROG", "ASUS", "AniMe", "Slash"] keywords = ["ROG", "ASUS", "AniMe", "Slash"]
edition = "2021"
exclude = ["data"] exclude = ["data"]
[features] [features]
@@ -21,20 +22,14 @@ name = "rog_slash"
path = "src/lib.rs" path = "src/lib.rs"
[dependencies] [dependencies]
png_pong.workspace = true
pix.workspace = true
gif.workspace = true
log.workspace = true
serde.workspace = true serde.workspace = true
serde_derive.workspace = true serde_derive.workspace = true
glam.workspace = true
typeshare.workspace = true typeshare.workspace = true
zbus = { workspace = true, optional = true } zbus = { workspace = true, optional = true }
dmi_id = { path = "../dmi-id", optional = true } dmi_id = { path = "../dmi-id", optional = true }
[dev-dependencies] [dev-dependencies]
cargo-husky.workspace = true cargo-husky.workspace = true
[package.metadata.cargo-machete]
ignored = ["serde"]
+6 -12
View File
@@ -1,14 +1,12 @@
[package] [package]
name = "rog_simulators" name = "rog_simulators"
license = "MPL-2.0" license.workspace = true
version.workspace = true version.workspace = true
readme = "README.md" readme.workspace = true
authors = ["Luke <luke@ljones.dev>"] authors.workspace = true
repository = "https://gitlab.com/asus-linux/asus-nb-ctrl" repository.workspace = true
homepage = "https://gitlab.com/asus-linux/asus-nb-ctrl" homepage.workspace = true
documentation = "https://docs.rs/rog-anime" edition.workspace = true
edition = "2021"
exclude = ["data"]
[[bin]] [[bin]]
name = "anime_sim" name = "anime_sim"
@@ -17,11 +15,7 @@ path = "src/simulator.rs"
[dependencies] [dependencies]
log.workspace = true log.workspace = true
glam.workspace = true
uhid-virt = "^0.0.7" uhid-virt = "^0.0.7"
rog_anime = { path = "../rog-anime", features = ["dbus"] } rog_anime = { path = "../rog-anime", features = ["dbus"] }
[dependencies.sdl2] [dependencies.sdl2]