From 326ca378476060cc55dc3b745412441d1866136f Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" Date: Thu, 26 Aug 2021 13:15:43 +1200 Subject: [PATCH] rog-supported crate --- CHANGELOG.md | 3 +++ Cargo.lock | 14 +++++++------- Cargo.toml | 2 +- asus-notify/Cargo.toml | 2 +- asus-notify/src/main.rs | 1 + asusctl/Cargo.toml | 2 +- asusctl/src/main.rs | 17 +++++++++-------- daemon-user/Cargo.toml | 2 +- daemon-user/src/daemon.rs | 8 ++++---- daemon/Cargo.toml | 2 +- daemon/src/ctrl_anime/mod.rs | 2 +- daemon/src/ctrl_aura/controller.rs | 2 +- daemon/src/ctrl_charge.rs | 2 +- daemon/src/ctrl_profiles/controller.rs | 2 +- daemon/src/ctrl_rog_bios.rs | 2 +- daemon/src/ctrl_supported.rs | 2 +- daemon/src/daemon.rs | 12 ++++++------ rog-dbus/Cargo.toml | 2 +- rog-dbus/src/zbus_supported.rs | 2 +- {rog-types => rog-supported}/Cargo.toml | 4 ++-- .../supported.rs => rog-supported/src/lib.rs | 2 ++ rog-types/src/lib.rs | 11 ----------- supergfx/Cargo.toml | 2 +- supergfx/src/daemon.rs | 4 ++-- supergfx/src/lib.rs | 3 ++- 25 files changed, 52 insertions(+), 55 deletions(-) rename {rog-types => rog-supported}/Cargo.toml (79%) rename rog-types/src/supported.rs => rog-supported/src/lib.rs (98%) delete mode 100644 rog-types/src/lib.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 18b391d8..6bca7573 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 + Support 8bit RGB, RGBA, 16bit Greyscalw, RGB, RGBA + add `AsusImage` type for slanted-template pixel-perfect images + `BREAKING:` plain `Image` with time period is changed and old anime configs break as a result (sorry) +### Changed +- Graphics control: + + BREAKING: graphics control is pulled out of asusd and moved to new crate; supergfxctl # [3.7.2] - 2021-08-02 ### Added diff --git a/Cargo.lock b/Cargo.lock index 45f268dc..7ccad0b9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,7 +37,7 @@ dependencies = [ "rog_aura", "rog_dbus", "rog_profiles", - "rog_types", + "rog_supported", "serde_json", "supergfxctl", "zbus", @@ -55,7 +55,7 @@ dependencies = [ "rog_aura", "rog_dbus", "rog_profiles", - "rog_types", + "rog_supported", "supergfxctl", "tinybmp", "zbus", @@ -217,7 +217,7 @@ dependencies = [ "rog_aura", "rog_dbus", "rog_profiles", - "rog_types", + "rog_supported", "rusb", "serde", "serde_derive", @@ -237,7 +237,7 @@ dependencies = [ "dirs 3.0.2", "rog_anime", "rog_dbus", - "rog_types", + "rog_supported", "serde", "serde_derive", "serde_json", @@ -924,7 +924,7 @@ dependencies = [ "rog_anime", "rog_aura", "rog_profiles", - "rog_types", + "rog_supported", "supergfxctl", "zbus", "zbus_macros", @@ -942,7 +942,7 @@ dependencies = [ ] [[package]] -name = "rog_types" +name = "rog_supported" version = "3.2.0" dependencies = [ "rog_aura", @@ -1068,7 +1068,7 @@ dependencies = [ [[package]] name = "supergfxctl" -version = "1.1.0" +version = "2.0.0" dependencies = [ "env_logger", "gumdrop", diff --git a/Cargo.toml b/Cargo.toml index e4983797..abc0d8d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["asusctl", "asus-notify", "daemon", "daemon-user", "rog-types", "rog-dbus", "rog-anime", "rog-aura", "rog-profiles", "supergfx"] +members = ["asusctl", "asus-notify", "daemon", "daemon-user", "rog-supported", "rog-dbus", "rog-anime", "rog-aura", "rog-profiles", "supergfx"] [profile.release] lto = true diff --git a/asus-notify/Cargo.toml b/asus-notify/Cargo.toml index a4d6d103..c81cab9c 100644 --- a/asus-notify/Cargo.toml +++ b/asus-notify/Cargo.toml @@ -12,7 +12,7 @@ zbus = "^1.9" serde_json = "^1.0" rog_dbus = { path = "../rog-dbus" } rog_aura = { path = "../rog-aura" } -rog_types = { path = "../rog-types" } +rog_supported = { path = "../rog-supported" } rog_profiles = { path = "../rog-profiles" } supergfxctl = { path = "../supergfx" } diff --git a/asus-notify/src/main.rs b/asus-notify/src/main.rs index bb3593bd..76353279 100644 --- a/asus-notify/src/main.rs +++ b/asus-notify/src/main.rs @@ -37,6 +37,7 @@ macro_rules! base_notification { fn main() -> Result<(), Box> { println!("asus-notify version {}", env!("CARGO_PKG_VERSION")); println!(" rog-dbus version {}", rog_dbus::VERSION); + println!("supergfxctl version {}", supergfxctl::VERSION); let (proxies, conn) = DbusProxies::new()?; let signals = Signals::new(&proxies)?; diff --git a/asusctl/Cargo.toml b/asusctl/Cargo.toml index 3c182768..23a6f1d8 100644 --- a/asusctl/Cargo.toml +++ b/asusctl/Cargo.toml @@ -12,7 +12,7 @@ rog_anime = { path = "../rog-anime" } rog_aura = { path = "../rog-aura" } rog_dbus = { path = "../rog-dbus" } rog_profiles = { path = "../rog-profiles" } -rog_types = { path = "../rog-types" } +rog_supported = { path = "../rog-supported" } daemon = { path = "../daemon" } gumdrop = "^0.8" supergfxctl = { path = "../supergfx" } diff --git a/asusctl/src/main.rs b/asusctl/src/main.rs index 448f04fd..09f6ad76 100644 --- a/asusctl/src/main.rs +++ b/asusctl/src/main.rs @@ -9,7 +9,7 @@ use profiles_cli::ProfileCommand; use rog_anime::{AnimeDataBuffer, AnimeImage, Vec2, ANIME_DATA_LEN}; use rog_aura::{self, AuraEffect}; use rog_dbus::RogDbusClient; -use rog_types::supported::{ +use rog_supported::{ AnimeSupportedFunctions, LedSupportedFunctions, PlatformProfileFunctions, RogBiosSupportedFunctions, }; @@ -139,14 +139,15 @@ fn main() -> Result<(), Box> { if parsed.version { println!("\nApp and daemon versions:"); - println!(" asusctl v{}", env!("CARGO_PKG_VERSION")); - println!(" asusd v{}", daemon::VERSION); + println!(" asusctl v{}", env!("CARGO_PKG_VERSION")); + println!(" asusd v{}", daemon::VERSION); println!("\nComponent crate versions:"); - println!(" rog-anime v{}", rog_anime::VERSION); - println!(" rog-aura v{}", rog_aura::VERSION); - println!(" rog-dbus v{}", rog_dbus::VERSION); - println!("rog-profiles v{}", rog_profiles::VERSION); - println!(" rog-types v{}", rog_types::VERSION); + println!(" rog-anime v{}", rog_anime::VERSION); + println!(" rog-aura v{}", rog_aura::VERSION); + println!(" rog-dbus v{}", rog_dbus::VERSION); + println!(" rog-profiles v{}", rog_profiles::VERSION); + println!("rog-supported v{}", rog_supported::VERSION); + println!(" supergfxctl v{}", supergfxctl::VERSION); return Ok(()); } diff --git a/daemon-user/Cargo.toml b/daemon-user/Cargo.toml index cf7f22cd..85751dc8 100644 --- a/daemon-user/Cargo.toml +++ b/daemon-user/Cargo.toml @@ -21,7 +21,7 @@ serde_derive = "^1.0" rog_anime = { path = "../rog-anime" } rog_dbus = { path = "../rog-dbus" } -rog_types = { path = "../rog-types" } +rog_supported = { path = "../rog-supported" } dirs = "3.0.1" diff --git a/daemon-user/src/daemon.rs b/daemon-user/src/daemon.rs index 14cdc532..d105f1de 100644 --- a/daemon-user/src/daemon.rs +++ b/daemon-user/src/daemon.rs @@ -12,10 +12,10 @@ use zbus::{fdo, Connection}; use std::sync::atomic::AtomicBool; fn main() -> Result<(), Box> { - println!(" user daemon v{}", rog_user::VERSION); - println!(" rog-anime v{}", rog_anime::VERSION); - println!(" rog-dbus v{}", rog_dbus::VERSION); - println!(" rog-types v{}", rog_types::VERSION); + println!(" user daemon v{}", rog_user::VERSION); + println!(" rog-anime v{}", rog_anime::VERSION); + println!(" rog-dbus v{}", rog_dbus::VERSION); + println!("rog-supported v{}", rog_supported::VERSION); let (client, _) = RogDbusClient::new().unwrap(); let supported = client.proxies().supported().get_supported_functions()?; diff --git a/daemon/Cargo.toml b/daemon/Cargo.toml index 60e167f8..f98837af 100644 --- a/daemon/Cargo.toml +++ b/daemon/Cargo.toml @@ -20,7 +20,7 @@ path = "src/daemon.rs" [dependencies] rog_anime = { path = "../rog-anime" } rog_aura = { path = "../rog-aura" } -rog_types = { path = "../rog-types" } +rog_supported = { path = "../rog-supported" } rog_profiles = { path = "../rog-profiles" } rog_dbus = { path = "../rog-dbus" } rusb = "^0.8" diff --git a/daemon/src/ctrl_anime/mod.rs b/daemon/src/ctrl_anime/mod.rs index 61c603a0..e96d2dc0 100644 --- a/daemon/src/ctrl_anime/mod.rs +++ b/daemon/src/ctrl_anime/mod.rs @@ -11,7 +11,7 @@ use rog_anime::{ }, ActionData, AnimeDataBuffer, AnimePacketType, ANIME_DATA_LEN, }; -use rog_types::supported::AnimeSupportedFunctions; +use rog_supported::AnimeSupportedFunctions; use rusb::{Device, DeviceHandle}; use std::{ error::Error, diff --git a/daemon/src/ctrl_aura/controller.rs b/daemon/src/ctrl_aura/controller.rs index 5cef3651..e294fa04 100644 --- a/daemon/src/ctrl_aura/controller.rs +++ b/daemon/src/ctrl_aura/controller.rs @@ -15,7 +15,7 @@ use rog_aura::{ }, AuraEffect, LedBrightness, LED_MSG_LEN, }; -use rog_types::supported::LedSupportedFunctions; +use rog_supported::LedSupportedFunctions; use std::io::{Read, Write}; use std::path::Path; use std::sync::Arc; diff --git a/daemon/src/ctrl_charge.rs b/daemon/src/ctrl_charge.rs index dbd7202d..b5a71594 100644 --- a/daemon/src/ctrl_charge.rs +++ b/daemon/src/ctrl_charge.rs @@ -1,7 +1,7 @@ use crate::{config::Config, error::RogError, GetSupported}; //use crate::dbus::DbusEvents; use log::{info, warn}; -use rog_types::supported::ChargeSupportedFunctions; +use rog_supported::ChargeSupportedFunctions; use std::fs::OpenOptions; use std::io::Write; use std::path::Path; diff --git a/daemon/src/ctrl_profiles/controller.rs b/daemon/src/ctrl_profiles/controller.rs index c49d130c..3faffcec 100644 --- a/daemon/src/ctrl_profiles/controller.rs +++ b/daemon/src/ctrl_profiles/controller.rs @@ -3,7 +3,7 @@ use crate::GetSupported; use log::{info, warn}; use rog_profiles::error::ProfileError; use rog_profiles::{FanCurves, Profile}; -use rog_types::supported::PlatformProfileFunctions; +use rog_supported::PlatformProfileFunctions; use std::sync::Arc; use std::sync::Mutex; diff --git a/daemon/src/ctrl_rog_bios.rs b/daemon/src/ctrl_rog_bios.rs index e2817e8b..d9fbef7c 100644 --- a/daemon/src/ctrl_rog_bios.rs +++ b/daemon/src/ctrl_rog_bios.rs @@ -1,6 +1,6 @@ use crate::{config::Config, error::RogError, GetSupported}; use log::{error, info, warn}; -use rog_types::supported::RogBiosSupportedFunctions; +use rog_supported::RogBiosSupportedFunctions; use std::fs::OpenOptions; use std::io::BufRead; use std::io::{Read, Write}; diff --git a/daemon/src/ctrl_supported.rs b/daemon/src/ctrl_supported.rs index 8f0f30de..6c1a04e6 100644 --- a/daemon/src/ctrl_supported.rs +++ b/daemon/src/ctrl_supported.rs @@ -9,7 +9,7 @@ use crate::{ ctrl_profiles::controller::CtrlPlatformProfile, ctrl_rog_bios::CtrlRogBios, GetSupported, }; -use rog_types::supported::{ +use rog_supported::{ AnimeSupportedFunctions, ChargeSupportedFunctions, LedSupportedFunctions, PlatformProfileFunctions, RogBiosSupportedFunctions, }; diff --git a/daemon/src/daemon.rs b/daemon/src/daemon.rs index 3b4be38f..105cfba9 100644 --- a/daemon/src/daemon.rs +++ b/daemon/src/daemon.rs @@ -54,12 +54,12 @@ pub fn main() -> Result<(), Box> { return Ok(()); } - info!(" daemon v{}", daemon::VERSION); - info!(" rog-anime v{}", rog_anime::VERSION); - info!(" rog-aura v{}", rog_aura::VERSION); - info!(" rog-dbus v{}", rog_dbus::VERSION); - info!("rog-profiles v{}", rog_profiles::VERSION); - info!(" rog-types v{}", rog_types::VERSION); + info!(" daemon v{}", daemon::VERSION); + info!(" rog-anime v{}", rog_anime::VERSION); + info!(" rog-aura v{}", rog_aura::VERSION); + info!(" rog-dbus v{}", rog_dbus::VERSION); + info!(" rog-profiles v{}", rog_profiles::VERSION); + info!("rog-supported v{}", rog_supported::VERSION); start_daemon()?; Ok(()) diff --git a/rog-dbus/Cargo.toml b/rog-dbus/Cargo.toml index aa97b47d..62011f70 100644 --- a/rog-dbus/Cargo.toml +++ b/rog-dbus/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" rog_anime = { path = "../rog-anime" } rog_aura = { path = "../rog-aura" } rog_profiles = { path = "../rog-profiles" } -rog_types = { path = "../rog-types" } +rog_supported = { path = "../rog-supported" } supergfxctl = { path = "../supergfx" } zbus = "^1.9" zbus_macros = "^1.9" diff --git a/rog-dbus/src/zbus_supported.rs b/rog-dbus/src/zbus_supported.rs index 565d7e92..54c06fb8 100644 --- a/rog-dbus/src/zbus_supported.rs +++ b/rog-dbus/src/zbus_supported.rs @@ -19,7 +19,7 @@ //! //! …consequently `zbus-xmlgen` did not generate code for the above interfaces. -use rog_types::supported::SupportedFunctions; +use rog_supported::SupportedFunctions; use zbus::{dbus_proxy, Connection, Result}; #[dbus_proxy( diff --git a/rog-types/Cargo.toml b/rog-supported/Cargo.toml similarity index 79% rename from rog-types/Cargo.toml rename to rog-supported/Cargo.toml index 34d07c45..6da0212e 100644 --- a/rog-types/Cargo.toml +++ b/rog-supported/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "rog_types" +name = "rog_supported" version = "3.2.0" license = "MPL-2.0" readme = "README.md" authors = ["Luke "] repository = "https://gitlab.com/asus-linux/asus-nb-ctrl" homepage = "https://gitlab.com/asus-linux/asus-nb-ctrl" -description = "A small library of effect types and conversions for ROG Aura" +description = "Helper to determine what is supported by asus laptops" edition = "2018" [dependencies] diff --git a/rog-types/src/supported.rs b/rog-supported/src/lib.rs similarity index 98% rename from rog-types/src/supported.rs rename to rog-supported/src/lib.rs index a132a814..203b0390 100644 --- a/rog-types/src/supported.rs +++ b/rog-supported/src/lib.rs @@ -1,3 +1,5 @@ +pub static VERSION: &str = env!("CARGO_PKG_VERSION"); + use rog_aura::AuraModeNum; use serde_derive::{Deserialize, Serialize}; use std::fmt; diff --git a/rog-types/src/lib.rs b/rog-types/src/lib.rs deleted file mode 100644 index eddc8a53..00000000 --- a/rog-types/src/lib.rs +++ /dev/null @@ -1,11 +0,0 @@ -//! This crate is intended for shared types (eg, between daemon and CLI), or -//! for types that might be useful in third-party crates perhaps for -//! sending messages over dbus wire - -pub static DBUS_NAME: &str = "org.asuslinux.Daemon"; -pub static DBUS_PATH: &str = "/org/asuslinux/Daemon"; -pub static DBUS_IFACE: &str = "org.asuslinux.Daemon"; - -pub mod supported; - -pub static VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/supergfx/Cargo.toml b/supergfx/Cargo.toml index 1bcfc747..7c0a93f3 100644 --- a/supergfx/Cargo.toml +++ b/supergfx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "supergfxctl" -version = "1.1.0" +version = "2.0.0" license = "MPL-2.0" readme = "README.md" authors = ["Luke "] diff --git a/supergfx/src/daemon.rs b/supergfx/src/daemon.rs index f898f046..5d684497 100644 --- a/supergfx/src/daemon.rs +++ b/supergfx/src/daemon.rs @@ -12,7 +12,7 @@ use supergfxctl::{ error::GfxError, gfx_vendors::GfxVendors, special::{get_asus_gsync_gfx_mode, has_asus_gsync_gfx_mode}, - DBUS_DEST_NAME, GFX_CONFIG_PATH, + CONFIG_PATH, DBUS_DEST_NAME, }; use zbus::{fdo, Connection, ObjectServer}; @@ -51,7 +51,7 @@ fn start_daemon() -> Result<(), Box> { let mut object_server = ObjectServer::new(&connection); - let config = GfxConfig::load(GFX_CONFIG_PATH.into()); + let config = GfxConfig::load(CONFIG_PATH.into()); let enable_gfx_switching = config.gfx_managed; let config = Arc::new(Mutex::new(config)); diff --git a/supergfx/src/lib.rs b/supergfx/src/lib.rs index 4fbc1af3..52a44f2b 100644 --- a/supergfx/src/lib.rs +++ b/supergfx/src/lib.rs @@ -9,7 +9,8 @@ pub mod system; pub mod zbus_iface; pub mod zbus_proxy; -pub const GFX_CONFIG_PATH: &str = "/etc/supergfxd.conf"; +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const CONFIG_PATH: &str = "/etc/supergfxd.conf"; pub const DBUS_DEST_NAME: &str = "org.supergfxctl.Daemon"; pub const DBUS_IFACE_PATH: &str = "/org/supergfxctl/Gfx";