Compare commits

...

28 Commits

Author SHA1 Message Date
Luke Jones 49234af08b Merge branch 'fluke/profiles' into 'main'
Fluke/profiles

See merge request asus-linux/asusctl!71
2021-08-01 22:53:38 +00:00
Luke D. Jones 8f5717def8 Version bump, various fixes 2021-08-02 10:50:17 +12:00
Luke D. Jones 9e55c0b2ca Fix incorrect name match of Star keyboard effect 2021-08-02 10:28:50 +12:00
Luke Jones dd6ee91364 Merge branch 'main' into 'main'
Enable multizone support on Strix 513IH

See merge request asus-linux/asusctl!69
2021-08-01 22:03:30 +00:00
Luke Jones efbb838ca1 Merge branch 'G513QY-ledmodes' into 'main'
add G513QY ledmodes

See merge request asus-linux/asusctl!70
2021-08-01 21:27:59 +00:00
Sonny Piers daf7d39d41 add G513QY ledmodes 2021-08-01 23:12:59 +02:00
pshem 28b1194924 Fix multizone support on Strix 513IH 2021-08-01 18:00:04 +01:00
Luke Jones 73d95ca187 Merge branch 'fluke/profiles' into 'main'
fix: Profile select by name is correctly choosing

Closes #96 and #100

See merge request asus-linux/asusctl!68
2021-07-31 12:19:28 +00:00
Luke D. Jones 00b7c6482f fix: remove the parsing for root supported functions 2021-08-01 00:15:38 +12:00
Luke D. Jones 29c26e8c89 fix: Profile select by name is correctly choosing
Closes #100 #96
2021-08-01 00:10:11 +12:00
Luke D. Jones fb124dd228 Fix clippy warnings 2021-07-31 23:09:23 +12:00
Luke D. Jones 0599be02dc fix: remove dbg!() output 2021-07-31 23:03:17 +12:00
Luke Jones 81a88263a9 Merge branch 'fluke/cli-fixes' into 'main'
Fluke/cli fixes

See merge request asus-linux/asusctl!67
2021-07-31 11:00:43 +00:00
Luke D. Jones cea1fd2540 Fix small issues with CLI 2021-07-31 22:57:17 +12:00
Luke Jones f2ced3bc7c Merge branch 'main' into 'main'
Add Zephyrus M GM501GS

Closes #109

See merge request asus-linux/asusctl!66
2021-07-30 23:48:58 +00:00
pshem dc2a05894b Add Zephyrus M GM501GS 2021-07-30 17:45:00 +01:00
Luke D. Jones 9ee962ad09 systemd: sleep 2 after unit init 2021-07-30 14:35:44 +12:00
Luke Jones eb7ef0af4f Merge branch 'main' into 'main'
add a protection to not allow running asusd in terminal

Closes #104

See merge request asus-linux/asusctl!64
2021-07-30 00:12:17 +00:00
Luke Jones dc51120c27 Merge branch 'main' into 'main'
Add G533QR and 513IH to ledmodes

See merge request asus-linux/asusctl!65
2021-07-30 00:11:05 +00:00
pshem fc4c2c4346 Add support for 513IH led modes 2021-07-24 19:34:09 +01:00
pshem 3f6be037c1 Add G533QR to ledmodes 2021-07-24 14:39:11 +01:00
Luke Jones 0a80c97f02 Update README.md 2021-07-13 04:36:39 +00:00
dragonn 88abafc728 add a protection to not allow running asusd in terminal 2021-07-09 18:40:38 +02:00
Luke Jones ac880a0363 Merge branch 'fluke/gfx-mode-changes' into 'main'
Fluke/gfx mode changes

See merge request asus-linux/asusctl!63
2021-06-10 21:06:56 +00:00
Luke D. Jones baebd51d99 Better control of gfx modes 2021-06-11 09:03:50 +12:00
Luke D. Jones 226620eb53 Fix up modes and icons 2021-06-07 19:19:49 +12:00
Luke D. Jones 1b34079d14 Trial of blocking vfio/compute unless in integrated mode 2021-06-07 11:02:21 +12:00
Luke D. Jones 8deeffcdad Minor fix to compute/vfio switch 2021-06-06 21:33:31 +12:00
40 changed files with 684 additions and 202 deletions
+15
View File
@@ -6,6 +6,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
# [3.7.2] - 2021-08-02
### Added
- Enable multizone support on Strix 513IH
- Add G513QY ledmodes
### Changed
- Fix missing CLI command help for some supported options
- Fix incorrectly selecting profile by name, where the active profile was being copied to the selected profile
- Add `asusd` version back to `asusctl -v` report
- Fix various clippy warnings
# [3.7.1] - 2021-06-11
### Changed
- Refine graphics mode switching:
+ Disallow switching to compute or vfio mode unless existing mode is "Integrated"
# [3.7.0] - 2021-06-06 # [3.7.0] - 2021-06-06
### Changed ### Changed
- Set PM to auto for Nvidia always - Set PM to auto for Nvidia always
Generated
+5 -4
View File
@@ -43,8 +43,9 @@ dependencies = [
[[package]] [[package]]
name = "asusctl" name = "asusctl"
version = "3.5.0" version = "3.5.1"
dependencies = [ dependencies = [
"daemon",
"gif", "gif",
"glam", "glam",
"gumdrop", "gumdrop",
@@ -206,7 +207,7 @@ dependencies = [
[[package]] [[package]]
name = "daemon" name = "daemon"
version = "3.7.0" version = "3.7.2"
dependencies = [ dependencies = [
"env_logger", "env_logger",
"log", "log",
@@ -918,7 +919,7 @@ dependencies = [
[[package]] [[package]]
name = "rog_dbus" name = "rog_dbus"
version = "3.5.0" version = "3.5.1"
dependencies = [ dependencies = [
"rog_anime", "rog_anime",
"rog_aura", "rog_aura",
@@ -940,7 +941,7 @@ dependencies = [
[[package]] [[package]]
name = "rog_profiles" name = "rog_profiles"
version = "0.1.1" version = "0.1.2"
dependencies = [ dependencies = [
"intel-pstate", "intel-pstate",
"rog_fan_curve", "rog_fan_curve",
+13
View File
@@ -56,6 +56,13 @@ install:
$(INSTALL_DATA) "./data/icons/asus_notif_yellow.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_yellow.png" $(INSTALL_DATA) "./data/icons/asus_notif_yellow.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_yellow.png"
$(INSTALL_DATA) "./data/icons/asus_notif_green.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_green.png" $(INSTALL_DATA) "./data/icons/asus_notif_green.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_green.png"
$(INSTALL_DATA) "./data/icons/asus_notif_red.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_red.png" $(INSTALL_DATA) "./data/icons/asus_notif_red.png" "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_red.png"
$(INSTALL_DATA) "./data/icons/scalable/gpu-compute.svg" "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-compute.svg"
$(INSTALL_DATA) "./data/icons/scalable/gpu-hybrid.svg" "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-hybrid.svg"
$(INSTALL_DATA) "./data/icons/scalable/gpu-integrated.svg" "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-integrated.svg"
$(INSTALL_DATA) "./data/icons/scalable/gpu-nvidia.svg" "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-nvidia.svg"
$(INSTALL_DATA) "./data/icons/scalable/gpu-vfio.svg" "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-vfio.svg"
$(INSTALL_DATA) "./data/icons/scalable/notification-reboot.svg" "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/notification-reboot.svg"
$(INSTALL_DATA) "./data/_asusctl" "$(DESTDIR)$(zshcpl)/_asusctl" $(INSTALL_DATA) "./data/_asusctl" "$(DESTDIR)$(zshcpl)/_asusctl"
$(INSTALL_DATA) "./data/completions/asusctl.fish" "$(DESTDIR)$(datarootdir)/fish/vendor_completions.d/asusctl.fish" $(INSTALL_DATA) "./data/completions/asusctl.fish" "$(DESTDIR)$(datarootdir)/fish/vendor_completions.d/asusctl.fish"
cd data && find "./anime" -type f -exec install -Dm 755 "{}" "$(DESTDIR)$(datarootdir)/asusd/{}" \; cd data && find "./anime" -type f -exec install -Dm 755 "{}" "$(DESTDIR)$(datarootdir)/asusd/{}" \;
@@ -74,6 +81,12 @@ uninstall:
rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_yellow.png" rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_yellow.png"
rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_green.png" rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_green.png"
rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_red.png" rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/512x512/apps/asus_notif_red.png"
rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-compute.svg"
rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-hybrid.svg"
rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-integrated.svg"
rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-nvidia.svg"
rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/gpu-vfio.svg"
rm -r "$(DESTDIR)$(datarootdir)/icons/hicolor/scalable/status/notification-reboot.svg"
rm -f "$(DESTDIR)$(zshcpl)/_asusctl" rm -f "$(DESTDIR)$(zshcpl)/_asusctl"
rm -f "$(DESTDIR)$(datarootdir)/fish/vendor_completions.d/asusctl.fish" rm -f "$(DESTDIR)$(datarootdir)/fish/vendor_completions.d/asusctl.fish"
rm -rf "$(DESTDIR)$(datarootdir)/asusd" rm -rf "$(DESTDIR)$(datarootdir)/asusd"
+2 -2
View File
@@ -25,7 +25,7 @@ Various patches are required for keyboard support. See [this post](https://asus-
## Discord ## Discord
[Discord server link](https://discord.gg/ngbdKabAnP) [Discord server link](https://discord.gg/4ZKGd7Un5t)
## SUPPORTED LAPTOPS ## SUPPORTED LAPTOPS
@@ -111,4 +111,4 @@ Reference to any ASUS products, services, processes, or other information and/or
The use of ROG and ASUS trademarks within this website and associated tools and libraries is only to provide a recognisable identifier to users to enable them to associate that these tools will work with ASUS ROG laptops. The use of ROG and ASUS trademarks within this website and associated tools and libraries is only to provide a recognisable identifier to users to enable them to associate that these tools will work with ASUS ROG laptops.
--- ---
+71 -14
View File
@@ -2,8 +2,10 @@ use notify_rust::{Hint, Notification, NotificationHandle};
use rog_aura::AuraEffect; use rog_aura::AuraEffect;
use rog_dbus::{DbusProxies, Signals}; use rog_dbus::{DbusProxies, Signals};
use rog_profiles::profiles::{FanLevel, Profile}; use rog_profiles::profiles::{FanLevel, Profile};
use rog_types::gfx_vendors::GfxRequiredUserAction;
use rog_types::gfx_vendors::GfxVendors; use rog_types::gfx_vendors::GfxVendors;
use std::error::Error; use std::error::Error;
use std::process;
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; use std::time::Duration;
@@ -20,6 +22,16 @@ macro_rules! notify {
}; };
} }
macro_rules! base_notification {
($body:expr) => {
Notification::new()
.summary(NOTIF_HEADER)
.body($body)
.timeout(2000)
.show()
};
}
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("asus-notify version {}", env!("CARGO_PKG_VERSION")); println!("asus-notify version {}", env!("CARGO_PKG_VERSION"));
println!(" rog-dbus version {}", rog_dbus::VERSION); println!(" rog-dbus version {}", rog_dbus::VERSION);
@@ -59,6 +71,19 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
if let Ok(data) = signals.gfx_vendor.try_recv() { if let Ok(data) = signals.gfx_vendor.try_recv() {
notify!(do_gfx_notif, last_notification, &data); notify!(do_gfx_notif, last_notification, &data);
} }
if let Ok(data) = signals.gfx_action.try_recv() {
match data {
GfxRequiredUserAction::Logout | GfxRequiredUserAction::Reboot => {
do_gfx_action_notif(&data)?;
}
GfxRequiredUserAction::Integrated => {
base_notification!(
"You must be in integrated mode first to switch to the requested mode"
)?;
}
GfxRequiredUserAction::None => {}
}
}
} }
} }
@@ -86,16 +111,6 @@ fn do_thermal_notif(profile: &Profile) -> Result<NotificationHandle, Box<dyn Err
Ok(x) Ok(x)
} }
macro_rules! base_notification {
($body:expr) => {
Notification::new()
.summary(NOTIF_HEADER)
.body($body)
.timeout(2000)
.show()
};
}
fn do_led_notif(ledmode: &AuraEffect) -> Result<NotificationHandle, notify_rust::error::Error> { fn do_led_notif(ledmode: &AuraEffect) -> Result<NotificationHandle, notify_rust::error::Error> {
base_notification!(&format!( base_notification!(&format!(
"Keyboard LED mode changed to {}", "Keyboard LED mode changed to {}",
@@ -108,8 +123,50 @@ fn do_charge_notif(limit: &u8) -> Result<NotificationHandle, notify_rust::error:
} }
fn do_gfx_notif(vendor: &GfxVendors) -> Result<NotificationHandle, notify_rust::error::Error> { fn do_gfx_notif(vendor: &GfxVendors) -> Result<NotificationHandle, notify_rust::error::Error> {
base_notification!(&format!( let icon = match vendor {
"Graphics mode changed to {}", GfxVendors::Nvidia => "/usr/share/icons/hicolor/scalable/status/gpu-nvidia.svg",
<&str>::from(vendor) GfxVendors::Integrated => "/usr/share/icons/hicolor/scalable/status/gpu-integrated.svg",
)) GfxVendors::Compute => "/usr/share/icons/hicolor/scalable/status/gpu-compute.svg",
GfxVendors::Vfio => "/usr/share/icons/hicolor/scalable/status/gpu-vfio.svg",
GfxVendors::Hybrid => "/usr/share/icons/hicolor/scalable/status/gpu-hybrid.svg",
};
Notification::new()
.summary(NOTIF_HEADER)
.body(&format!(
"Graphics mode changed to {}",
<&str>::from(vendor)
))
.timeout(2000)
.icon(icon)
.show()
}
fn do_gfx_action_notif(vendor: &GfxRequiredUserAction) -> Result<(), notify_rust::error::Error> {
let mut notif = Notification::new()
.summary(NOTIF_HEADER)
.timeout(2000)
.urgency(notify_rust::Urgency::Critical)
.icon("/usr/share/icons/hicolor/scalable/status/notification-reboot.svg")
.finalize();
if matches!(vendor, GfxRequiredUserAction::Logout) {
notif.action("logout", "Logout now?");
} else if matches!(vendor, GfxRequiredUserAction::Reboot) {
notif.action("reboot", "Reboot now?");
}
notif.body("Graphics mode changed");
notif.show()?.wait_for_action(|action| match action {
"logout" => {
process::Command::new("gnome-session-quit").spawn().ok();
}
"reboot" => {
process::Command::new("systemctl")
.arg("reboot")
.spawn()
.ok();
}
_ => (),
});
Ok(())
} }
+2 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "asusctl" name = "asusctl"
version = "3.5.0" version = "3.5.1"
authors = ["Luke D Jones <luke@ljones.dev>"] authors = ["Luke D Jones <luke@ljones.dev>"]
edition = "2018" edition = "2018"
@@ -12,6 +12,7 @@ rog_aura = { path = "../rog-aura" }
rog_dbus = { path = "../rog-dbus" } rog_dbus = { path = "../rog-dbus" }
rog_profiles = { path = "../rog-profiles" } rog_profiles = { path = "../rog-profiles" }
rog_types = { path = "../rog-types" } rog_types = { path = "../rog-types" }
daemon = { path = "../daemon" }
rog_fan_curve = { version = "^0.1", features = ["serde"] } rog_fan_curve = { version = "^0.1", features = ["serde"] }
gumdrop = "^0.8" gumdrop = "^0.8"
yansi-term = "^0.1" yansi-term = "^0.1"
+4 -2
View File
@@ -124,6 +124,8 @@ pub struct MultiColourSpeed {
/// Byte value for setting the built-in mode. /// Byte value for setting the built-in mode.
/// ///
/// Enum corresponds to the required integer value /// Enum corresponds to the required integer value
///
// NOTE: The option names here must match those in rog-aura crate
#[derive(Options)] #[derive(Options)]
pub enum SetAuraBuiltin { pub enum SetAuraBuiltin {
#[options(help = "set a single static colour")] #[options(help = "set a single static colour")]
@@ -135,7 +137,7 @@ pub enum SetAuraBuiltin {
#[options(help = "rainbow cycling in one of four directions")] #[options(help = "rainbow cycling in one of four directions")]
Rainbow(SingleSpeedDirection), Rainbow(SingleSpeedDirection),
#[options(help = "rain pattern mimicking raindrops")] #[options(help = "rain pattern mimicking raindrops")]
Star(TwoColourSpeed), Stars(TwoColourSpeed),
#[options(help = "rain pattern of three preset colours")] #[options(help = "rain pattern of three preset colours")]
Rain(SingleSpeed), Rain(SingleSpeed),
#[options(help = "pressed keys are highlighted to fade")] #[options(help = "pressed keys are highlighted to fade")]
@@ -233,7 +235,7 @@ impl From<&SetAuraBuiltin> for AuraEffect {
data.mode = AuraModeNum::Rainbow; data.mode = AuraModeNum::Rainbow;
data data
} }
SetAuraBuiltin::Star(x) => { SetAuraBuiltin::Stars(x) => {
let mut data: AuraEffect = x.into(); let mut data: AuraEffect = x.into();
data.mode = AuraModeNum::Star; data.mode = AuraModeNum::Star;
data data
+43 -74
View File
@@ -11,10 +11,9 @@ use rog_aura::{self, AuraEffect};
use rog_dbus::RogDbusClient; use rog_dbus::RogDbusClient;
use rog_profiles::profiles::Profile; use rog_profiles::profiles::Profile;
use rog_types::{ use rog_types::{
gfx_vendors::GfxVendors, gfx_vendors::{GfxRequiredUserAction, GfxVendors},
supported::{ supported::{
FanCpuSupportedFunctions, LedSupportedFunctions, RogBiosSupportedFunctions, FanCpuSupportedFunctions, LedSupportedFunctions, RogBiosSupportedFunctions,
SupportedFunctions,
}, },
}; };
use std::{env::args, path::Path}; use std::{env::args, path::Path};
@@ -133,16 +132,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let supported = dbus.proxies().supported().get_supported_functions()?; let supported = dbus.proxies().supported().get_supported_functions()?;
if parsed.help {
print_supported_help(&supported, &parsed);
println!("\nSee https://asus-linux.org/faq/ for additional help");
std::process::exit(1);
}
if parsed.version { if parsed.version {
println!(" asusctl v{}", env!("CARGO_PKG_VERSION")); println!("\nApp and daemon versions:");
println!(" rog-dbus v{}", rog_dbus::VERSION); println!(" asusctl v{}", env!("CARGO_PKG_VERSION"));
println!("rog-types v{}", rog_types::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);
return Ok(()); return Ok(());
} }
@@ -224,8 +223,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
if parsed.show_supported { if parsed.show_supported {
let dat = dbus.proxies().supported().get_supported_functions()?; println!("Supported laptop functions:\n\n{}", supported);
println!("Supported laptop functions:\n\n{}", dat);
} }
if let Some(chg_limit) = parsed.chg_limit { if let Some(chg_limit) = parsed.chg_limit {
@@ -235,57 +233,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Ok(()) Ok(())
} }
fn print_supported_help(supported: &SupportedFunctions, parsed: &CliStart) {
// As help option don't work with `parse_args_default`
// we will call `parse_args_default_or_exit` instead
let usage: Vec<String> = parsed.self_usage().lines().map(|s| s.to_string()).collect();
for line in usage.iter().filter(|line| {
if line.contains("--fan-mode") && !supported.fan_cpu_ctrl.stock_fan_modes {
return false;
}
if line.contains("--chg-limit") && !supported.charge_ctrl.charge_level_set {
return false;
}
true
}) {
println!("{}", line);
}
// command strings are in order of the struct
let commands: Vec<String> = CliCommand::usage().lines().map(|s| s.to_string()).collect();
println!("\nCommands available");
for line in commands.iter().filter(|line| {
if line.contains("profile")
&& !supported.fan_cpu_ctrl.stock_fan_modes
&& !supported.fan_cpu_ctrl.fan_curve_set
{
return false;
}
if line.contains("led-mode") && !supported.keyboard_led.stock_led_modes.is_empty() {
return false;
}
if line.contains("bios")
&& (!supported.rog_bios_ctrl.dedicated_gfx_toggle
|| !supported.rog_bios_ctrl.post_sound_toggle)
{
return false;
}
if line.contains("anime") && !supported.anime_ctrl.0 {
return false;
}
true
}) {
println!("{}", line);
}
if !supported.fan_cpu_ctrl.stock_fan_modes {
println!("Note: Fan mode control is not supported by this laptop");
}
if !supported.charge_ctrl.charge_level_set {
println!("Note: Charge control is not supported by this laptop");
}
}
fn do_gfx( fn do_gfx(
dbus: &RogDbusClient, dbus: &RogDbusClient,
supported: &RogBiosSupportedFunctions, supported: &RogBiosSupportedFunctions,
@@ -309,11 +256,24 @@ fn do_gfx(
err err
})?; })?;
let res = dbus.gfx_wait_changed()?; let res = dbus.gfx_wait_changed()?;
println!( match res {
"Graphics mode changed to {}. User action required is: {}", GfxRequiredUserAction::Integrated => {
<&str>::from(mode), println!(
<&str>::from(&res) "You must change to Integrated before you can change to {}",
); <&str>::from(mode)
);
}
GfxRequiredUserAction::Logout | GfxRequiredUserAction::Reboot => {
println!(
"Graphics mode changed to {}. User action required is: {}",
<&str>::from(mode),
<&str>::from(&res)
);
}
GfxRequiredUserAction::None => {
println!("Graphics mode changed to {}", <&str>::from(mode));
}
}
std::process::exit(0) std::process::exit(0)
} }
if command.get { if command.get {
@@ -356,7 +316,7 @@ fn handle_led_mode(
.collect(); .collect();
for command in commands.iter().filter(|command| { for command in commands.iter().filter(|command| {
for mode in &supported.stock_led_modes { for mode in &supported.stock_led_modes {
if command.contains(<&str>::from(mode)) { if command.contains(&<&str>::from(mode).to_lowercase()) {
return true; return true;
} }
} }
@@ -481,12 +441,21 @@ fn handle_profile(
} }
let mut set_profile = false; let mut set_profile = false;
let mut profile; let mut profile = Profile::default();
if cmd.create { if cmd.create {
profile = Profile::default();
set_profile = true; set_profile = true;
} else { } else if let Some(ref name) = cmd.profile {
profile = dbus.proxies().profile().active_data()?; let profiles = dbus.proxies().profile().all_profile_data()?;
for p in profiles {
if p.name == *name {
profile = p;
break;
}
}
if profile.name != *name {
println!("The requested profile doesn't exist, you may need to create it");
std::process::exit(-1);
}
} }
if let Some(turbo) = cmd.turbo { if let Some(turbo) = cmd.turbo {
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "daemon" name = "daemon"
version = "3.7.0" version = "3.7.2"
license = "MPL-2.0" license = "MPL-2.0"
readme = "README.md" readme = "README.md"
authors = ["Luke <luke@ljones.dev>"] authors = ["Luke <luke@ljones.dev>"]
+3 -3
View File
@@ -90,7 +90,7 @@ impl AuraConfig {
let mut buf = String::new(); let mut buf = String::new();
if let Ok(read_len) = file.read_to_string(&mut buf) { if let Ok(read_len) = file.read_to_string(&mut buf) {
if read_len == 0 { if read_len == 0 {
return AuraConfig::create_default(&mut file, &supported_led_modes); return AuraConfig::create_default(&mut file, supported_led_modes);
} else { } else {
if let Ok(data) = serde_json::from_str(&buf) { if let Ok(data) = serde_json::from_str(&buf) {
return data; return data;
@@ -109,7 +109,7 @@ impl AuraConfig {
panic!("Please remove {} then restart asusd", AURA_CONFIG_PATH); panic!("Please remove {} then restart asusd", AURA_CONFIG_PATH);
} }
} }
AuraConfig::create_default(&mut file, &supported_led_modes) AuraConfig::create_default(&mut file, supported_led_modes)
} }
fn create_default(file: &mut File, support_data: &LaptopLedData) -> Self { fn create_default(file: &mut File, support_data: &LaptopLedData) -> Self {
@@ -153,7 +153,7 @@ impl AuraConfig {
.unwrap_or_else(|err| error!("Could not write config: {}", err)); .unwrap_or_else(|err| error!("Could not write config: {}", err));
} }
/// Multipurpose, will accecpt AuraEffect with zones and put in the correct store /// Multipurpose, will accept AuraEffect with zones and put in the correct store
pub fn set_builtin(&mut self, effect: AuraEffect) { pub fn set_builtin(&mut self, effect: AuraEffect) {
match effect.zone() { match effect.zone() {
AuraZone::None => { AuraZone::None => {
+78 -55
View File
@@ -9,7 +9,6 @@ use logind_zbus::{
}; };
use rog_types::gfx_vendors::{GfxPower, GfxRequiredUserAction, GfxVendors}; use rog_types::gfx_vendors::{GfxPower, GfxRequiredUserAction, GfxVendors};
use std::{io::Write, ops::Add, path::Path, time::Instant}; use std::{io::Write, ops::Add, path::Path, time::Instant};
use std::{iter::FromIterator, thread::JoinHandle};
use std::{process::Command, thread::sleep, time::Duration}; use std::{process::Command, thread::sleep, time::Duration};
use std::{str::FromStr, sync::mpsc}; use std::{str::FromStr, sync::mpsc};
use std::{sync::Arc, sync::Mutex}; use std::{sync::Arc, sync::Mutex};
@@ -79,20 +78,20 @@ impl CtrlGraphics {
match dev.vendor()? { match dev.vendor()? {
0x1002 => { 0x1002 => {
info!("GFX: {}: AMD graphics", dev.id()); info!("GFX: {}: AMD graphics", dev.id());
amd.push(GraphicsDevice::new(dev.id().to_owned(), functions(&dev))); amd.push(GraphicsDevice::new(dev.id().to_owned(), functions(dev)));
} }
0x10DE => { 0x10DE => {
info!("GFX: {}: NVIDIA graphics", dev.id()); info!("GFX: {}: NVIDIA graphics", dev.id());
dev.set_runtime_pm(sysfs_class::RuntimePowerManagement::On)?; dev.set_runtime_pm(sysfs_class::RuntimePowerManagement::On)?;
nvidia.push(GraphicsDevice::new(dev.id().to_owned(), functions(&dev))); nvidia.push(GraphicsDevice::new(dev.id().to_owned(), functions(dev)));
} }
0x8086 => { 0x8086 => {
info!("GFX: {}: Intel graphics", dev.id()); info!("GFX: {}: Intel graphics", dev.id());
intel.push(GraphicsDevice::new(dev.id().to_owned(), functions(&dev))); intel.push(GraphicsDevice::new(dev.id().to_owned(), functions(dev)));
} }
vendor => { vendor => {
info!("GFX: {}: Other({:X}) graphics", dev.id(), vendor); info!("GFX: {}: Other({:X}) graphics", dev.id(), vendor);
other.push(GraphicsDevice::new(dev.id().to_owned(), functions(&dev))); other.push(GraphicsDevice::new(dev.id().to_owned(), functions(dev)));
} }
} }
} }
@@ -126,7 +125,7 @@ impl CtrlGraphics {
} }
/// Associated method to get which vendor mode is set /// Associated method to get which vendor mode is set
pub fn get_gfx_mode(&self) -> Result<GfxVendors, RogError> { pub(super) fn get_gfx_mode(&self) -> Result<GfxVendors, RogError> {
if let Ok(config) = self.config.lock() { if let Ok(config) = self.config.lock() {
if let Some(mode) = config.gfx_tmp_mode { if let Some(mode) = config.gfx_tmp_mode {
return Ok(mode); return Ok(mode);
@@ -265,16 +264,17 @@ impl CtrlGraphics {
let unbinds = devices.iter().map(|dev| dev.unbind()); let unbinds = devices.iter().map(|dev| dev.unbind());
// Remove NVIDIA graphics devices and their functions // Remove NVIDIA graphics devices and their functions
let removes = devices.iter().map(|dev| dev.remove()); let removes = devices.iter().map(|dev| dev.remove());
Result::from_iter(unbinds.chain(removes)) unbinds.chain(removes).collect::<Result<_, _>>()
.map_err(|err| RogError::Command("device unbind error".into(), err)) .map_err(|err| RogError::Command("device unbind error".into(), err))
} }
fn unbind_only(devices: &[GraphicsDevice]) -> Result<(), RogError> { fn unbind_only(devices: &[GraphicsDevice]) -> Result<(), RogError> {
let unbinds = devices.iter().map(|dev| dev.unbind()); let unbinds = devices.iter().map(|dev| dev.unbind());
Result::from_iter(unbinds) unbinds.collect::<Result<_, _>>()
.map_err(|err| RogError::Command("device unbind error".into(), err)) .map_err(|err| RogError::Command("device unbind error".into(), err))
} }
/// Add or remove driver modules
fn do_driver_action(driver: &str, action: &str) -> Result<(), GfxError> { fn do_driver_action(driver: &str, action: &str) -> Result<(), GfxError> {
let mut cmd = Command::new(action); let mut cmd = Command::new(action);
cmd.arg(driver); cmd.arg(driver);
@@ -359,14 +359,15 @@ impl CtrlGraphics {
let mut count = 0; let mut count = 0;
while count <= 5 { while count <= (4 * 3) {
// 3 seconds max
let output = cmd let output = cmd
.output() .output()
.map_err(|err| RogError::Command(format!("{:?}", cmd), err))?; .map_err(|err| RogError::Command(format!("{:?}", cmd), err))?;
if output.stdout.starts_with(state.as_bytes()) { if output.stdout.starts_with(state.as_bytes()) {
return Ok(()); return Ok(());
} }
std::thread::sleep(std::time::Duration::from_millis(500)); std::thread::sleep(std::time::Duration::from_millis(250));
count += 1; count += 1;
} }
Err(GfxError::DisplayManagerTimeout(state.into()).into()) Err(GfxError::DisplayManagerTimeout(state.into()).into())
@@ -374,9 +375,10 @@ impl CtrlGraphics {
/// Determine if we need to logout/thread. Integrated<->Vfio mode does not /// Determine if we need to logout/thread. Integrated<->Vfio mode does not
/// require logout. /// require logout.
fn logout_required(&self, vendor: GfxVendors) -> GfxRequiredUserAction { fn is_logout_required(&self, vendor: GfxVendors) -> GfxRequiredUserAction {
if let Ok(config) = self.config.lock() { if let Ok(config) = self.config.lock() {
let current = config.gfx_mode; let current = config.gfx_mode;
// Modes that can switch without logout
if matches!( if matches!(
current, current,
GfxVendors::Integrated | GfxVendors::Vfio | GfxVendors::Compute GfxVendors::Integrated | GfxVendors::Vfio | GfxVendors::Compute
@@ -386,22 +388,28 @@ impl CtrlGraphics {
) { ) {
return GfxRequiredUserAction::None; return GfxRequiredUserAction::None;
} }
// Modes that require a switch to integrated first
if matches!(current, GfxVendors::Nvidia | GfxVendors::Hybrid)
&& matches!(vendor, GfxVendors::Compute | GfxVendors::Vfio)
{
return GfxRequiredUserAction::Integrated;
}
} }
GfxRequiredUserAction::Logout GfxRequiredUserAction::Logout
} }
/// Write the config changes and add/remove drivers and devices depending /// Do a full setup flow for the chosen mode:
/// on selected mode:
/// ///
/// Tasks: /// Tasks:
/// - rescan for devices
/// - write xorg config /// - write xorg config
/// - write modprobe config /// - write modprobe config
/// - rescan for devices
/// + add drivers /// + add drivers
/// + or remove drivers and devices /// + or remove drivers and devices
/// ///
/// The daemon needs direct access to this function when it detects that the /// The daemon needs direct access to this function when it detects that the
pub fn do_vendor_tasks( /// bios has G-Sync switch is enabled
pub fn do_mode_setup_tasks(
vendor: GfxVendors, vendor: GfxVendors,
vfio_enable: bool, vfio_enable: bool,
devices: &[GraphicsDevice], devices: &[GraphicsDevice],
@@ -425,8 +433,14 @@ impl CtrlGraphics {
dev.set_runtime_pm(sysfs_class::RuntimePowerManagement::On)?; dev.set_runtime_pm(sysfs_class::RuntimePowerManagement::On)?;
} }
} }
// // Only these modes should have xorg config
Self::write_xorg_conf(vendor)?; if matches!(
vendor,
GfxVendors::Nvidia | GfxVendors::Hybrid | GfxVendors::Integrated
) {
Self::write_xorg_conf(vendor)?;
}
// Write different modprobe to enable boot control to work // Write different modprobe to enable boot control to work
Self::write_modprobe_conf(vendor, devices)?; Self::write_modprobe_conf(vendor, devices)?;
@@ -447,7 +461,7 @@ impl CtrlGraphics {
for driver in NVIDIA_DRIVERS.iter() { for driver in NVIDIA_DRIVERS.iter() {
Self::do_driver_action(driver, "rmmod")?; Self::do_driver_action(driver, "rmmod")?;
} }
Self::unbind_only(&devices)?; Self::unbind_only(devices)?;
Self::do_driver_action("vfio-pci", "modprobe")?; Self::do_driver_action("vfio-pci", "modprobe")?;
} else { } else {
return Err(GfxError::VfioDisabled.into()); return Err(GfxError::VfioDisabled.into());
@@ -463,7 +477,7 @@ impl CtrlGraphics {
for driver in NVIDIA_DRIVERS.iter() { for driver in NVIDIA_DRIVERS.iter() {
Self::do_driver_action(driver, "rmmod")?; Self::do_driver_action(driver, "rmmod")?;
} }
Self::unbind_remove_nvidia(&devices)?; Self::unbind_remove_nvidia(devices)?;
} }
} }
Ok(()) Ok(())
@@ -492,7 +506,7 @@ impl CtrlGraphics {
} }
/// Spools until all user sessions are ended then switches to requested mode /// Spools until all user sessions are ended then switches to requested mode
fn fire_starter( fn create_mode_change_thread(
vendor: GfxVendors, vendor: GfxVendors,
devices: Vec<GraphicsDevice>, devices: Vec<GraphicsDevice>,
bus: PciBus, bus: PciBus,
@@ -538,7 +552,7 @@ impl CtrlGraphics {
Self::do_display_manager_action("stop")?; Self::do_display_manager_action("stop")?;
Self::wait_display_manager_state("inactive")?; Self::wait_display_manager_state("inactive")?;
let mut mode_to_save = vendor; let mut mode_to_save = vendor;
// Need to change to integrated before we can change to vfio or compute // Need to change to integrated before we can change to vfio or compute
if let Ok(mut config) = config.try_lock() { if let Ok(mut config) = config.try_lock() {
// Since we have a lock, reset tmp to none. This thread should only ever run // Since we have a lock, reset tmp to none. This thread should only ever run
@@ -546,18 +560,17 @@ impl CtrlGraphics {
config.gfx_tmp_mode = None; config.gfx_tmp_mode = None;
// //
let vfio_enable = config.gfx_vfio_enable; let vfio_enable = config.gfx_vfio_enable;
// Failsafe. In the event this loop is run with a switch from nvidia in use
// to vfio or compute do a forced switch to integrated instead to prevent issues
if matches!(vendor, GfxVendors::Compute | GfxVendors::Vfio) if matches!(vendor, GfxVendors::Compute | GfxVendors::Vfio)
&& matches!(config.gfx_mode, GfxVendors::Nvidia | GfxVendors::Hybrid) && matches!(config.gfx_mode, GfxVendors::Nvidia | GfxVendors::Hybrid)
{ {
Self::do_vendor_tasks(GfxVendors::Integrated, vfio_enable, &devices, &bus)?; Self::do_mode_setup_tasks(GfxVendors::Integrated, vfio_enable, &devices, &bus)?;
Self::do_display_manager_action("restart")?; Self::do_display_manager_action("restart")?;
sleep(Duration::from_millis(1000)); // Allow some time for the desktop to start
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
config.gfx_tmp_mode = Some(vendor);
mode_to_save = GfxVendors::Integrated; mode_to_save = GfxVendors::Integrated;
} else { } else {
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?; Self::do_mode_setup_tasks(vendor, vfio_enable, &devices, &bus)?;
Self::do_display_manager_action("restart")?; Self::do_display_manager_action("restart")?;
} }
} }
@@ -572,7 +585,7 @@ impl CtrlGraphics {
} }
/// Before starting a new thread the old one *must* be cancelled /// Before starting a new thread the old one *must* be cancelled
fn cancel_thread(&self) { fn cancel_mode_change_thread(&self) {
if let Ok(lock) = self.thread_kill.lock() { if let Ok(lock) = self.thread_kill.lock() {
if let Some(tx) = lock.as_ref() { if let Some(tx) = lock.as_ref() {
// Cancel the running thread // Cancel the running thread
@@ -587,7 +600,7 @@ impl CtrlGraphics {
} }
/// The thread is used only in cases where a logout is required /// The thread is used only in cases where a logout is required
fn setup_thread(&mut self, vendor: GfxVendors) { fn setup_mode_change_thread(&mut self, vendor: GfxVendors) {
let config = self.config.clone(); let config = self.config.clone();
let devices = self.nvidia.clone(); let devices = self.nvidia.clone();
let bus = self.bus.clone(); let bus = self.bus.clone();
@@ -595,16 +608,16 @@ impl CtrlGraphics {
if let Ok(mut lock) = self.thread_kill.lock() { if let Ok(mut lock) = self.thread_kill.lock() {
*lock = Some(tx); *lock = Some(tx);
} }
let killer = self.thread_kill.clone(); let thread_kill = self.thread_kill.clone();
let _join: JoinHandle<()> = std::thread::spawn(move || { std::thread::spawn(move || {
Self::fire_starter(vendor, devices, bus, rx, config) Self::create_mode_change_thread(vendor, devices, bus, rx, config)
.map_err(|err| { .map_err(|err| {
error!("GFX: {}", err); error!("GFX: {}", err);
}) })
.ok(); .ok();
// clear the tx/rx when done // clear the tx/rx when done
if let Ok(mut lock) = killer.try_lock() { if let Ok(mut lock) = thread_kill.try_lock() {
*lock = None; *lock = None;
} }
}); });
@@ -615,10 +628,7 @@ impl CtrlGraphics {
/// to switch modes. /// to switch modes.
/// ///
/// For manually calling (not on boot/startup) via dbus /// For manually calling (not on boot/startup) via dbus
pub fn set_gfx_config( pub fn set_gfx_mode(&mut self, vendor: GfxVendors) -> Result<GfxRequiredUserAction, RogError> {
&mut self,
vendor: GfxVendors,
) -> Result<GfxRequiredUserAction, RogError> {
if let Ok(gsync) = CtrlRogBios::get_gfx_mode() { if let Ok(gsync) = CtrlRogBios::get_gfx_mode() {
if gsync == 1 { if gsync == 1 {
return Err(GfxError::GsyncModeActive.into()); return Err(GfxError::GsyncModeActive.into());
@@ -636,27 +646,40 @@ impl CtrlGraphics {
} }
// Must always cancel any thread running // Must always cancel any thread running
self.cancel_thread(); self.cancel_mode_change_thread();
// determine which method we need here // determine which method we need here
let action_required = self.logout_required(vendor); let action_required = self.is_logout_required(vendor);
if matches!(action_required, GfxRequiredUserAction::Logout) {
// Yeah need the thread to check if all users are logged out match action_required {
info!("GFX: mode change requires a logout to complete"); GfxRequiredUserAction::Logout => {
self.setup_thread(vendor); info!("GFX: mode change requires a logout to complete");
} else { self.setup_mode_change_thread(vendor);
// Okay cool, we can switch on/off vfio }
info!("GFX: mode change does not require logout"); GfxRequiredUserAction::Reboot => {
let devices = self.nvidia.clone(); info!("GFX: mode change requires reboot");
let bus = self.bus.clone(); let devices = self.nvidia.clone();
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?; let bus = self.bus.clone();
info!("GFX: Graphics mode changed to {}", <&str>::from(vendor)); Self::do_mode_setup_tasks(vendor, vfio_enable, &devices, &bus)?;
if matches!(vendor, GfxVendors::Vfio | GfxVendors::Compute) { info!("GFX: Graphics mode changed to {}", <&str>::from(vendor));
}
GfxRequiredUserAction::Integrated => {
info!("GFX: mode change requires user to be in Integrated mode first");
}
GfxRequiredUserAction::None => {
info!("GFX: mode change does not require logout");
let devices = self.nvidia.clone();
let bus = self.bus.clone();
Self::do_mode_setup_tasks(vendor, vfio_enable, &devices, &bus)?;
info!("GFX: Graphics mode changed to {}", <&str>::from(vendor));
if let Ok(mut config) = self.config.try_lock() { if let Ok(mut config) = self.config.try_lock() {
config.gfx_tmp_mode = Some(vendor); config.gfx_tmp_mode = None;
}; if matches!(vendor, GfxVendors::Vfio | GfxVendors::Compute) {
config.gfx_tmp_mode = Some(vendor);
}
}
} }
} }
// TODO: undo if failed? Save last mode, catch errors...
Ok(action_required) Ok(action_required)
} }
@@ -672,7 +695,7 @@ impl CtrlGraphics {
false false
}; };
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?; Self::do_mode_setup_tasks(vendor, vfio_enable, &devices, &bus)?;
Self::toggle_fallback_service(vendor)?; Self::toggle_fallback_service(vendor)?;
Ok(()) Ok(())
} }
+2 -2
View File
@@ -83,7 +83,7 @@ impl GraphicsDevice {
Ok(driver) => { Ok(driver) => {
info!("{}: Unbinding {}", driver.id(), func.id()); info!("{}: Unbinding {}", driver.id(), func.id());
unsafe { unsafe {
driver.unbind(&func).map_err(|err| { driver.unbind(func).map_err(|err| {
error!("gfx unbind: {}", err); error!("gfx unbind: {}", err);
err err
})?; })?;
@@ -109,7 +109,7 @@ impl GraphicsDevice {
Ok(driver) => { Ok(driver) => {
info!("{}: Binding {}", driver.id(), func.id()); info!("{}: Binding {}", driver.id(), func.id());
unsafe { unsafe {
driver.bind(&func).map_err(|err| { driver.bind(func).map_err(|err| {
error!("gfx bind: {}", err); error!("gfx bind: {}", err);
err err
})?; })?;
+1 -1
View File
@@ -25,7 +25,7 @@ impl CtrlGraphics {
fn set_vendor(&mut self, vendor: GfxVendors) -> zbus::fdo::Result<GfxRequiredUserAction> { fn set_vendor(&mut self, vendor: GfxVendors) -> zbus::fdo::Result<GfxRequiredUserAction> {
info!("GFX: Switching gfx mode to {}", <&str>::from(vendor)); info!("GFX: Switching gfx mode to {}", <&str>::from(vendor));
let msg = self.set_gfx_config(vendor).map_err(|err| { let msg = self.set_gfx_mode(vendor).map_err(|err| {
error!("GFX: {}", err); error!("GFX: {}", err);
zbus::fdo::Error::Failed(format!("GFX fail: {}", err)) zbus::fdo::Error::Failed(format!("GFX fail: {}", err))
})?; })?;
+9 -8
View File
@@ -17,11 +17,11 @@ use rog_aura::{
AuraEffect, LedBrightness, LED_MSG_LEN, AuraEffect, LedBrightness, LED_MSG_LEN,
}; };
use rog_types::supported::LedSupportedFunctions; use rog_types::supported::LedSupportedFunctions;
use std::{fs::OpenOptions, thread::spawn};
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::path::Path; use std::path::Path;
use std::sync::Arc; use std::sync::Arc;
use std::sync::Mutex; use std::sync::Mutex;
use std::{fs::OpenOptions, thread::spawn};
use zbus::Connection; use zbus::Connection;
use crate::GetSupported; use crate::GetSupported;
@@ -75,12 +75,13 @@ impl<'a> CtrlKbdLedTask<'a> {
// wait a fraction for things to wake up properly // wait a fraction for things to wake up properly
//std::thread::sleep(Duration::from_millis(100)); //std::thread::sleep(Duration::from_millis(100));
loop { loop {
if let Ok(ref mut lock) = c1.try_lock() { if let Ok(ref mut lock) = c1.try_lock() {
lock.set_brightness(lock.config.brightness).ok(); lock.set_brightness(lock.config.brightness).ok();
break; break;
}} }
}
}); });
} }
Ok(()) Ok(())
}) })
.map_err(|err| { .map_err(|err| {
@@ -369,7 +370,7 @@ impl CtrlKbdLed {
self.config.read(); self.config.read();
if let Some(data) = self.config.builtins.get(&next) { if let Some(data) = self.config.builtins.get(&next) {
self.write_mode(&data)?; self.write_mode(data)?;
self.config.current_mode = next; self.config.current_mode = next;
} }
self.config.write(); self.config.write();
@@ -380,7 +381,7 @@ impl CtrlKbdLed {
#[inline] #[inline]
fn write_mode(&self, mode: &AuraEffect) -> Result<(), RogError> { fn write_mode(&self, mode: &AuraEffect) -> Result<(), RogError> {
if !self.supported_modes.standard.contains(&mode.mode()) { if !self.supported_modes.standard.contains(mode.mode()) {
return Err(RogError::NotSupported); return Err(RogError::NotSupported);
} }
let bytes: [u8; LED_MSG_LEN] = mode.into(); let bytes: [u8; LED_MSG_LEN] = mode.into();
+23 -8
View File
@@ -1,6 +1,6 @@
use crate::error::RogError; use crate::error::RogError;
use crate::{config::Config, GetSupported}; use crate::{config::Config, GetSupported};
use log::info; use log::{info, warn};
use rog_profiles::profiles::Profile; use rog_profiles::profiles::Profile;
use rog_types::supported::FanCpuSupportedFunctions; use rog_types::supported::FanCpuSupportedFunctions;
use std::sync::Arc; use std::sync::Arc;
@@ -23,12 +23,12 @@ impl GetSupported for CtrlFanAndCpu {
} }
impl crate::Reloadable for CtrlFanAndCpu { impl crate::Reloadable for CtrlFanAndCpu {
/// Fetcht he active profile and use that to set all related components up
fn reload(&mut self) -> Result<(), RogError> { fn reload(&mut self) -> Result<(), RogError> {
if let Ok(mut cfg) = self.config.clone().try_lock() { if let Ok(mut cfg) = self.config.clone().try_lock() {
let active = cfg.active_profile.clone(); let active = cfg.active_profile.clone();
if let Some(existing) = cfg.power_profiles.get_mut(&active) { if let Some(existing) = cfg.power_profiles.get_mut(&active) {
existing.set_system_all()?; existing.set_system_all()?;
cfg.write();
} }
} }
Ok(()) Ok(())
@@ -38,31 +38,38 @@ impl crate::Reloadable for CtrlFanAndCpu {
impl CtrlFanAndCpu { impl CtrlFanAndCpu {
pub fn new(config: Arc<Mutex<Config>>) -> Result<Self, RogError> { pub fn new(config: Arc<Mutex<Config>>) -> Result<Self, RogError> {
Profile::get_fan_path()?; Profile::get_fan_path()?;
info!("Device has thermal throttle control"); info!("Device has fan control available");
Ok(CtrlFanAndCpu { config }) Ok(CtrlFanAndCpu { config })
} }
/// Toggle to next profile in list /// Toggle to next profile in list
pub(super) fn do_next_profile(&mut self) -> Result<(), RogError> { pub(super) fn do_next_profile(&mut self) -> Result<(), RogError> {
if let Ok(mut config) = self.config.clone().try_lock() { if let Ok(mut config) = self.config.clone().try_lock() {
// Read first just incase the user has modified the config before calling this
config.read(); config.read();
let mut i = config let mut toggle_index = config
.toggle_profiles .toggle_profiles
.binary_search(&config.active_profile) .binary_search(&config.active_profile)
.unwrap_or(0) .unwrap_or(0)
+ 1; + 1;
if i >= config.toggle_profiles.len() { if toggle_index >= config.toggle_profiles.len() {
i = 0; toggle_index = 0;
} }
let profile = config.toggle_profiles[i].clone(); let profile = config.toggle_profiles[toggle_index].clone();
if let Some(existing) = config.power_profiles.get(&profile) { if let Some(existing) = config.power_profiles.get(&profile) {
existing.set_system_all()?; existing.set_system_all()?;
config.active_profile = existing.name.clone(); config.active_profile = existing.name.clone();
config.write(); config.write();
info!("Profile was changed to: {}", profile); info!("Profile was changed to: {}", &profile);
} else {
warn!(
"toggle_profile {} does not exist in power_profiles",
&profile
);
return Err(RogError::MissingProfile(profile.to_string()));
} }
} }
Ok(()) Ok(())
@@ -70,17 +77,25 @@ impl CtrlFanAndCpu {
pub(super) fn set_active(&mut self, profile: &str) -> Result<(), RogError> { pub(super) fn set_active(&mut self, profile: &str) -> Result<(), RogError> {
if let Ok(mut config) = self.config.clone().try_lock() { if let Ok(mut config) = self.config.clone().try_lock() {
// Read first just incase the user has modified the config before calling this
config.read(); config.read();
if let Some(existing) = config.power_profiles.get(profile) { if let Some(existing) = config.power_profiles.get(profile) {
existing.set_system_all()?; existing.set_system_all()?;
config.active_profile = existing.name.clone(); config.active_profile = existing.name.clone();
config.write(); config.write();
info!("Profile was changed to: {}", profile); info!("Profile was changed to: {}", profile);
} else {
warn!(
"toggle_profile {} does not exist in power_profiles",
profile
);
return Err(RogError::MissingProfile(profile.to_string()));
} }
} }
Ok(()) Ok(())
} }
/// Create a new profile if the requested name doesn't exist, or modify existing
pub(super) fn new_or_modify(&mut self, profile: &Profile) -> Result<(), RogError> { pub(super) fn new_or_modify(&mut self, profile: &Profile) -> Result<(), RogError> {
if let Ok(mut config) = self.config.clone().try_lock() { if let Ok(mut config) = self.config.clone().try_lock() {
config.read(); config.read();
+1 -1
View File
@@ -139,7 +139,7 @@ impl FanAndCpuZbus {
if let Ok(ctrl) = self.inner.try_lock() { if let Ok(ctrl) = self.inner.try_lock() {
if let Ok(cfg) = ctrl.config.clone().try_lock() { if let Ok(cfg) = ctrl.config.clone().try_lock() {
if let Some(profile) = cfg.power_profiles.get(&cfg.active_profile) { if let Some(profile) = cfg.power_profiles.get(&cfg.active_profile) {
self.notify_profile(&profile) self.notify_profile(profile)
.unwrap_or_else(|err| warn!("{}", err)); .unwrap_or_else(|err| warn!("{}", err));
} }
} }
+15 -2
View File
@@ -20,6 +20,7 @@ use std::error::Error;
use std::io::Write; use std::io::Write;
use std::sync::Arc; use std::sync::Arc;
use std::sync::Mutex; use std::sync::Mutex;
use std::env;
use daemon::ctrl_rog_bios::CtrlRogBios; use daemon::ctrl_rog_bios::CtrlRogBios;
use std::convert::Into; use std::convert::Into;
@@ -35,6 +36,18 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
.filter(None, LevelFilter::Info) .filter(None, LevelFilter::Info)
.init(); .init();
let is_service = match env::var_os("IS_SERVICE") {
Some(val) => val == "1",
None => false,
};
if !is_service {
println!("asusd schould be only run from the right systemd service");
println!("do not run in your terminal, if you need an logs please use journalctl -b -u asusd");
println!("asusd will now exit");
return Ok(());
}
info!(" daemon v{}", daemon::VERSION); info!(" daemon v{}", daemon::VERSION);
info!(" rog-anime v{}", rog_anime::VERSION); info!(" rog-anime v{}", rog_anime::VERSION);
info!(" rog-aura v{}", rog_aura::VERSION); info!(" rog-aura v{}", rog_aura::VERSION);
@@ -155,7 +168,7 @@ fn start_daemon() -> Result<(), Box<dyn Error>> {
warn!("Dedicated GFX toggle is on but driver mode is not nvidia \nSetting to nvidia driver mode"); warn!("Dedicated GFX toggle is on but driver mode is not nvidia \nSetting to nvidia driver mode");
let devices = ctrl.devices(); let devices = ctrl.devices();
let bus = ctrl.bus(); let bus = ctrl.bus();
CtrlGraphics::do_vendor_tasks( CtrlGraphics::do_mode_setup_tasks(
GfxVendors::Nvidia, GfxVendors::Nvidia,
false, false,
&devices, &devices,
@@ -165,7 +178,7 @@ fn start_daemon() -> Result<(), Box<dyn Error>> {
info!("Dedicated GFX toggle is off"); info!("Dedicated GFX toggle is off");
let devices = ctrl.devices(); let devices = ctrl.devices();
let bus = ctrl.bus(); let bus = ctrl.bus();
CtrlGraphics::do_vendor_tasks( CtrlGraphics::do_mode_setup_tasks(
config.gfx_mode, config.gfx_mode,
false, false,
&devices, &devices,
-2
View File
@@ -8,7 +8,6 @@ use crate::ctrl_gfx::error::GfxError;
#[derive(Debug)] #[derive(Debug)]
pub enum RogError { pub enum RogError {
ParseFanLevel,
ParseVendor, ParseVendor,
ParseLed, ParseLed,
MissingProfile(String), MissingProfile(String),
@@ -36,7 +35,6 @@ impl fmt::Display for RogError {
// This trait requires `fmt` with this exact signature. // This trait requires `fmt` with this exact signature.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self { match self {
RogError::ParseFanLevel => write!(f, "Parse profile error"),
RogError::ParseVendor => write!(f, "Parse gfx vendor error"), RogError::ParseVendor => write!(f, "Parse gfx vendor error"),
RogError::ParseLed => write!(f, "Parse LED error"), RogError::ParseLed => write!(f, "Parse LED error"),
RogError::MissingProfile(profile) => write!(f, "Profile does not exist {}", profile), RogError::MissingProfile(profile) => write!(f, "Profile does not exist {}", profile),
+1
View File
@@ -3,6 +3,7 @@ Description=ASUS Notebook Control
After=basic.target syslog.target After=basic.target syslog.target
[Service] [Service]
Environment=IS_SERVICE=1
ExecStart=/usr/bin/asusd ExecStart=/usr/bin/asusd
Restart=on-failure Restart=on-failure
Type=dbus Type=dbus
+16 -2
View File
@@ -12,6 +12,13 @@ standard = ["Static", "Breathe", "Strobe", "Rainbow", "Star", "Rain", "Highlight
multizone = false multizone = false
per_key = true per_key = true
[[led_data]]
prod_family = "Zephyrus M"
board_names = ["GM501GS"]
standard = ["Static", "Breathe", "Strobe", "Rainbow", "Pulse"]
multizone = true
per_key = false
[[led_data]] [[led_data]]
prod_family = "ROG Zephyrus M15" prod_family = "ROG Zephyrus M15"
board_names = ["GU502LW"] board_names = ["GU502LW"]
@@ -35,14 +42,14 @@ per_key = false
[[led_data]] [[led_data]]
prod_family = "ROG Strix" prod_family = "ROG Strix"
board_names = ["G531GW", "G733QS", "G733QR"] board_names = ["G531GW", "G533QR", "G733QS", "G733QR"]
standard = ["Static", "Breathe", "Strobe", "Rainbow", "Star", "Rain", "Highlight", "Laser", "Ripple", "Pulse", "Comet", "Flash"] standard = ["Static", "Breathe", "Strobe", "Rainbow", "Star", "Rain", "Highlight", "Laser", "Ripple", "Pulse", "Comet", "Flash"]
multizone = false multizone = false
per_key = true per_key = true
[[led_data]] [[led_data]]
prod_family = "ROG Strix" prod_family = "ROG Strix"
board_names = ["GX531", "G512LV", "G712LV", "G712LW"] board_names = ["GX531", "G512LV", "G712LV", "G712LW", "G513QY"]
standard = ["Static", "Breathe", "Strobe", "Rainbow", "Pulse"] standard = ["Static", "Breathe", "Strobe", "Rainbow", "Pulse"]
multizone = true multizone = true
per_key = false per_key = false
@@ -54,6 +61,13 @@ standard = ["Static", "Breathe", "Strobe", "Rainbow", "Pulse"]
multizone = false multizone = false
per_key = false per_key = false
[[led_data]]
prod_family = "ROG Strix"
board_names = ["G513IH"]
standard = ["Static", "Breathe", "Strobe", "Rainbow", "Star", "Pulse"]
multizone = true
per_key = false
[[led_data]] [[led_data]]
prod_family = "Strix" prod_family = "Strix"
board_names = ["G731GV", "G731GW", "G531GV"] board_names = ["G731GV", "G731GW", "G531GV"]
+2
View File
@@ -5,6 +5,8 @@ StartLimitBurst=2
Before=display-manager.service Before=display-manager.service
[Service] [Service]
Environment=IS_SERVICE=1
ExecStartPre=/bin/sleep 2
ExecStart=/usr/bin/asusd ExecStart=/usr/bin/asusd
Restart=on-failure Restart=on-failure
Restart=always Restart=always
+86
View File
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Gravit.io -->
<svg
style="isolation:isolate"
viewBox="0 0 82.733002 82.733002"
width="82.733002pt"
height="82.733002pt"
version="1.1"
id="svg19"
sodipodi:docname="gpu-compute.svg"
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview21"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="pt"
showgrid="false"
inkscape:zoom="4.96875"
inkscape:cx="15.597484"
inkscape:cy="54.742138"
inkscape:window-width="2048"
inkscape:window-height="1083"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg19" />
<defs
id="defs5">
<clipPath
id="_clipPath_ZEBBDq6ZtbLgkRXocTHUWTcRbcURZIva">
<rect
width="128"
height="128"
id="rect2"
x="0"
y="0" />
</clipPath>
</defs>
<g
clip-path="url(#_clipPath_ZEBBDq6ZtbLgkRXocTHUWTcRbcURZIva)"
id="g17"
transform="translate(-22.624,-23)">
<rect
width="128"
height="128"
style="fill:#000000"
fill-opacity="0"
id="rect7"
x="0"
y="0" />
<g
id="g15">
<path
id="path9"
style="opacity:1;mix-blend-mode:normal;fill:#ed1c24;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 13.789062,13.789062 v 6.894532 H 0 v 6.894531 H 13.789062 V 41.367188 H 0 v 6.894531 H 13.789062 V 62.048828 H 0 v 6.894531 H 13.789062 V 82.732422 H 0 v 6.894531 h 13.789062 v 6.894531 h 6.894532 v 13.789066 h 6.894531 V 96.521484 h 13.789063 v 13.789066 h 6.894531 V 96.521484 h 13.789062 v 13.789066 h 6.892578 V 96.521484 h 13.789063 v 13.789066 h 6.896484 V 96.521484 h 6.894532 z"
transform="matrix(0.75,0,0,0.75,22.624,23)" />
<path
id="path9-3"
style="isolation:isolate;mix-blend-mode:normal;fill:#76b900;fill-opacity:1;stroke:#000000;stroke-width:0.375;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 95.016578,95.391113 -0.0051,-5.170896 10.341782,-0.01017 -0.005,-5.170896 -10.341789,0.01017 -0.01017,-10.341791 10.341799,-0.01018 -0.005,-5.170895 -10.341787,0.01018 -0.01017,-10.340328 10.341797,-0.01017 -0.005,-5.170896 -10.341794,0.01017 -0.01018,-10.341792 10.341784,-0.01017 -0.005,-5.170895 -10.341791,0.01017 -0.0051,-5.170897 -5.170898,0.0051 -0.01017,-10.341796 -5.170896,0.0051 0.01017,10.341797 -10.341792,0.01017 -0.01017,-10.341795 -5.170897,0.0051 0.01017,10.341796 -10.341791,0.01017 -0.01017,-10.341796 -5.169431,0.0051 0.01017,10.341795 -10.341792,0.01018 -0.01017,-10.341797 -5.172361,0.0051 0.01017,10.341795 -5.170894,0.0051 z" />
<rect
x="38.146"
y="38.512001"
width="51.708"
height="51.708"
fill="rgb(77,77,77)"
id="rect11"
style="fill:none" />
<path
d="m 67.238,81.543 c 3.416,0 7.169,-0.866 10.056,-2.262 l -1.395,-4.474 c -2.165,0.818 -4.86,1.299 -7.169,1.299 -7.313,0 -11.884,-4.811 -11.884,-12.317 0,-7.073 4.138,-11.114 11.162,-11.114 2.646,0 5.678,0.529 7.843,1.395 l 1.732,-4.811 c -2.839,-1.347 -6.111,-2.069 -9.43,-2.069 -10.537,0 -17.754,6.976 -17.754,17.465 0,10.104 6.832,16.888 16.839,16.888 z"
fill="#dddddd"
id="path13"
style="stroke:#000000;stroke-opacity:1;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

+82
View File
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Gravit.io -->
<svg
style="isolation:isolate"
viewBox="0 0 82.733002 82.733002"
width="82.733002pt"
height="82.733002pt"
version="1.1"
id="svg19"
sodipodi:docname="gpu-hybrid.svg"
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview21"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="pt"
showgrid="false"
inkscape:zoom="4.96875"
inkscape:cx="15.798742"
inkscape:cy="54.742138"
inkscape:window-width="2048"
inkscape:window-height="1083"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg19" />
<defs
id="defs5">
<clipPath
id="_clipPath_uVSrFPVusaaYDISWhfCjIlGBeb9FaZAr">
<rect
width="128"
height="128"
id="rect2"
x="0"
y="0" />
</clipPath>
</defs>
<g
clip-path="url(#_clipPath_uVSrFPVusaaYDISWhfCjIlGBeb9FaZAr)"
id="g17"
transform="translate(-22.624,-23)">
<rect
width="128"
height="128"
style="fill:#000000"
fill-opacity="0"
id="rect7"
x="0"
y="0" />
<g
id="g15">
<path
d="m 38.137,23 v 10.342 h -5.171 v 5.17 H 22.624 v 5.171 H 32.966 V 54.025 H 22.624 v 5.171 H 32.966 V 69.537 H 22.624 v 5.171 H 32.966 V 85.05 H 22.624 v 5.17 h 10.342 v 5.171 h 5.171 v 10.342 h 5.171 V 95.391 h 10.341 v 10.342 H 58.82 V 95.391 h 10.342 v 10.342 h 5.17 V 95.391 h 10.342 v 10.342 h 5.171 V 95.391 h 5.171 V 90.22 h 10.341 V 85.05 H 95.016 V 74.708 h 10.341 V 69.537 H 95.016 V 59.196 h 10.341 V 54.025 H 95.016 V 43.683 h 10.341 V 38.512 H 95.016 v -5.17 H 89.845 V 23 H 84.674 V 33.342 H 74.332 V 23 h -5.17 V 33.342 H 58.82 V 23 H 53.649 V 33.342 H 43.308 V 23 Z"
fill="rgb(77,77,77)"
id="path9"
style="fill:#ed1c24;fill-opacity:1;stroke:#000000;stroke-opacity:1;stroke-width:0.75;stroke-miterlimit:4;stroke-dasharray:none" />
<rect
x="38.146"
y="38.512001"
width="51.708"
height="51.708"
fill="rgb(77,77,77)"
id="rect11"
style="fill:#76b900;fill-opacity:1;stroke:#000000;stroke-opacity:1" />
<path
d="m 51.464,79 h 5.663 V 66.118 H 70.916 V 79 h 5.62 V 49 h -5.62 V 61.147 H 57.127 V 49 h -5.663 z"
fill="rgb(221,221,221)"
id="path13"
style="fill:#ececec;stroke:#000000;stroke-opacity:1;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

+52
View File
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Gravit.io -->
<svg
style="isolation:isolate"
viewBox="0 0 82.410369 82.410377"
width="82.41037pt"
height="82.410378pt"
version="1.1"
id="svg17"
sodipodi:docname="gpu-integrated.svg"
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview19"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="pt"
showgrid="false"
inkscape:zoom="4.96875"
inkscape:cx="14.389937"
inkscape:cy="54.742138"
inkscape:window-width="2048"
inkscape:window-height="1083"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg17" />
<defs
id="defs5">
<clipPath
id="_clipPath_GAg6mcrkdqJgsmZOjvo6JT6R1d3r9FoI">
<rect
width="128"
height="128"
id="rect2"
x="0"
y="0" />
</clipPath>
</defs>
<path
style="fill:#ed1c24;fill-opacity:1;stroke:#000000;stroke-width:0.75;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 15.92217,76.9033 V 71.771223 H 13.28066 10.63915 V 69.129715 66.488208 H 5.507075 0.375 v -2.037735 -2.037735 h 5.132075 5.132075 v -5.73585 -5.73585 H 5.507075 0.375 V 48.903302 46.865566 H 5.507075 10.63915 V 41.205189 35.544811 H 5.507075 0.375 V 33.431604 31.318396 H 5.507075 10.63915 V 25.658019 19.997641 H 5.507075 0.375 V 17.959906 15.92217 h 5.132075 5.132075 v -2.641509 -2.64151 h 2.64151 2.64151 V 5.5070763 0.375 h 2.037736 2.037735 v 5.1320763 5.1320747 h 5.660378 5.660377 V 5.5070763 0.375 h 2.113207 2.113208 v 5.1320763 5.1320747 h 5.660377 5.660378 V 5.5070763 0.375 h 1.947066 1.947063 l 0.09711,1.8490563 c 0.07996,1.52246 0.251242,6.717377 0.253724,7.695141 0.0014,0.5274167 -0.04609,0.5197837 3.905982,0.6286047 1.618867,0.04457 3.945285,0.123799 5.16981,0.176053 l 2.226412,0.09501 V 5.5969303 0.375 h 2.037735 2.037743 v 5.1320763 5.1320747 h 2.641507 2.641508 v 2.64151 2.641509 h 5.132077 5.13207 v 2.037736 2.037735 h -5.13207 -5.132077 v 5.660378 5.660377 h 5.132077 5.13207 v 2.113208 2.113207 h -5.13207 -5.132077 v 5.660378 5.660377 h 5.132077 5.13207 v 2.037736 2.037736 h -5.13207 -5.132077 v 5.73585 5.73585 h 5.132077 5.13207 v 2.037735 2.037735 h -5.13207 -5.132077 v 2.641507 2.641508 H 69.129718 66.488211 V 76.9033 82.035378 H 64.450468 62.412733 V 76.9033 71.771223 h -5.73585 -5.735846 V 76.9033 82.035378 H 48.903301 46.865566 V 76.9033 71.771223 H 41.205188 35.544811 V 76.9033 82.035378 H 33.431603 31.318396 V 76.9033 71.771223 H 25.658019 19.997641 V 76.9033 82.035378 H 17.959906 15.92217 Z"
id="path1355" />
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

+52
View File
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Gravit.io -->
<svg
style="isolation:isolate"
viewBox="0 0 82.410369 82.410377"
width="82.41037pt"
height="82.410378pt"
version="1.1"
id="svg17"
sodipodi:docname="gpu-nvidia.svg"
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview19"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="pt"
showgrid="false"
inkscape:zoom="4.96875"
inkscape:cx="14.389937"
inkscape:cy="54.742138"
inkscape:window-width="2048"
inkscape:window-height="1083"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg17" />
<defs
id="defs5">
<clipPath
id="_clipPath_GAg6mcrkdqJgsmZOjvo6JT6R1d3r9FoI">
<rect
width="128"
height="128"
id="rect2"
x="0"
y="0" />
</clipPath>
</defs>
<path
style="fill:#76b900;fill-opacity:1;stroke:#000000;stroke-width:0.75;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 15.92217,76.9033 V 71.771223 H 13.28066 10.63915 V 69.129715 66.488208 H 5.507075 0.375 v -2.037735 -2.037735 h 5.132075 5.132075 v -5.73585 -5.73585 H 5.507075 0.375 V 48.903302 46.865566 H 5.507075 10.63915 V 41.205189 35.544811 H 5.507075 0.375 V 33.431604 31.318396 H 5.507075 10.63915 V 25.658019 19.997641 H 5.507075 0.375 V 17.959906 15.92217 h 5.132075 5.132075 v -2.641509 -2.64151 h 2.64151 2.64151 V 5.5070763 0.375 h 2.037736 2.037735 v 5.1320763 5.1320747 h 5.660378 5.660377 V 5.5070763 0.375 h 2.113207 2.113208 v 5.1320763 5.1320747 h 5.660377 5.660378 V 5.5070763 0.375 h 1.947066 1.947063 l 0.09711,1.8490563 c 0.07996,1.52246 0.251242,6.717377 0.253724,7.695141 0.0014,0.5274167 -0.04609,0.5197837 3.905982,0.6286047 1.618867,0.04457 3.945285,0.123799 5.16981,0.176053 l 2.226412,0.09501 V 5.5969303 0.375 h 2.037735 2.037743 v 5.1320763 5.1320747 h 2.641507 2.641508 v 2.64151 2.641509 h 5.132077 5.13207 v 2.037736 2.037735 h -5.13207 -5.132077 v 5.660378 5.660377 h 5.132077 5.13207 v 2.113208 2.113207 h -5.13207 -5.132077 v 5.660378 5.660377 h 5.132077 5.13207 v 2.037736 2.037736 h -5.13207 -5.132077 v 5.73585 5.73585 h 5.132077 5.13207 v 2.037735 2.037735 h -5.13207 -5.132077 v 2.641507 2.641508 H 69.129718 66.488211 V 76.9033 82.035378 H 64.450468 62.412733 V 76.9033 71.771223 h -5.73585 -5.735846 V 76.9033 82.035378 H 48.903301 46.865566 V 76.9033 71.771223 H 41.205188 35.544811 V 76.9033 82.035378 H 33.431603 31.318396 V 76.9033 71.771223 H 25.658019 19.997641 V 76.9033 82.035378 H 17.959906 15.92217 Z"
id="path1355" />
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

+86
View File
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Gravit.io -->
<svg
style="isolation:isolate"
viewBox="0 0 82.733002 82.733002"
width="82.733002pt"
height="82.733002pt"
version="1.1"
id="svg19"
sodipodi:docname="gpu-vfio.svg"
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview21"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="pt"
showgrid="false"
inkscape:zoom="7.8686859"
inkscape:cx="55.091791"
inkscape:cy="55.155334"
inkscape:window-width="2048"
inkscape:window-height="1083"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg19" />
<defs
id="defs5">
<clipPath
id="_clipPath_ZEBBDq6ZtbLgkRXocTHUWTcRbcURZIva">
<rect
width="128"
height="128"
id="rect2"
x="0"
y="0" />
</clipPath>
</defs>
<g
clip-path="url(#_clipPath_ZEBBDq6ZtbLgkRXocTHUWTcRbcURZIva)"
id="g17"
transform="translate(-22.624,-23)">
<rect
width="128"
height="128"
style="fill:#000000"
fill-opacity="0"
id="rect7"
x="0"
y="0" />
<g
id="g15">
<path
id="path9"
style="opacity:1;mix-blend-mode:normal;fill:#ed1c24;fill-opacity:1;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 13.789062,13.789062 v 6.894532 H 0 v 6.894531 H 13.789062 V 41.367188 H 0 v 6.894531 H 13.789062 V 62.048828 H 0 v 6.894531 H 13.789062 V 82.732422 H 0 v 6.894531 h 13.789062 v 6.894531 h 6.894532 v 13.789066 h 6.894531 V 96.521484 h 13.789063 v 13.789066 h 6.894531 V 96.521484 h 13.789062 v 13.789066 h 6.892578 V 96.521484 h 13.789063 v 13.789066 h 6.896484 V 96.521484 h 6.894532 z"
transform="matrix(0.75,0,0,0.75,22.624,23)" />
<path
id="path9-3"
style="isolation:isolate;mix-blend-mode:normal;fill:#76b900;fill-opacity:1;stroke:#000000;stroke-width:0.375;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 95.016578,95.391113 -0.0051,-5.170896 10.341782,-0.01017 -0.005,-5.170896 -10.341789,0.01017 -0.01017,-10.341791 10.341799,-0.01018 -0.005,-5.170895 -10.341787,0.01018 -0.01017,-10.340328 10.341797,-0.01017 -0.005,-5.170896 -10.341794,0.01017 -0.01018,-10.341792 10.341784,-0.01017 -0.005,-5.170895 -10.341791,0.01017 -0.0051,-5.170897 -5.170898,0.0051 -0.01017,-10.341796 -5.170896,0.0051 0.01017,10.341797 -10.341792,0.01017 -0.01017,-10.341795 -5.170897,0.0051 0.01017,10.341796 -10.341791,0.01017 -0.01017,-10.341796 -5.169431,0.0051 0.01017,10.341795 -10.341792,0.01018 -0.01017,-10.341797 -5.172361,0.0051 0.01017,10.341795 -5.170894,0.0051 z" />
<rect
x="38.146"
y="38.512001"
width="51.708"
height="51.708"
fill="rgb(77,77,77)"
id="rect11"
style="fill:none" />
</g>
</g>
<path
d="m 38.016104,57.595764 h 6.037 l 11.263,-31.267 h -5.947 l -8.064,24.374 -7.75,-24.374 h -6.758 z"
fill="#dddddd"
id="path849"
style="isolation:isolate;stroke:#000000;stroke-opacity:1;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;fill:#ffffff" />
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- Generator: Gravit.io --><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="isolation:isolate" viewBox="141 297.96 507.339 471.04" width="507.339pt" height="471.04pt"><g><g><g><g><path d=" M 537.075 443.463 L 537.075 443.463 L 564.723 427.335 C 504.903 324.571 375.966 285.313 269.027 337.304 L 269.027 297.96 L 237.027 297.96 L 237.027 393.96 L 333.027 393.96 L 333.027 361.96 L 292.147 361.96 C 382.665 323.563 487.612 358.486 537.075 443.463 Z " fill="rgb(204,64,64)"/><path d=" M 245.027 692.775 C 170.84 632.524 151.314 527.353 198.931 444.488 L 171.187 428.488 C 116.876 523.063 137.426 642.887 220.147 713.96 L 181.027 713.96 L 181.027 745.96 L 277.027 745.96 L 277.027 649.96 L 245.027 649.96 L 245.027 692.775 L 245.027 692.775 Z " fill="rgb(204,64,64)"/><path d=" M 580.451 499.048 L 512.579 566.936 L 535.203 589.56 L 562.403 562.36 C 551.734 661.49 468.201 736.724 368.499 737 L 368.499 769 C 487.289 768.688 585.833 677.011 594.707 558.552 L 625.715 589.56 L 648.339 566.936 L 580.451 499.048 Z " fill="rgb(204,64,64)"/></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

+6 -6
View File
@@ -64,7 +64,7 @@ impl ActionData {
time: duration, time: duration,
brightness, brightness,
} => ActionData::Animation(AnimeGif::create_diagonal_gif( } => ActionData::Animation(AnimeGif::create_diagonal_gif(
&file, file,
*duration, *duration,
*brightness, *brightness,
)?), )?),
@@ -79,7 +79,7 @@ impl ActionData {
if let Some(ext) = file.extension() { if let Some(ext) = file.extension() {
if ext.to_string_lossy().to_lowercase() == "png" { if ext.to_string_lossy().to_lowercase() == "png" {
return Ok(ActionData::Animation(AnimeGif::create_png_static( return Ok(ActionData::Animation(AnimeGif::create_png_static(
&file, file,
*scale, *scale,
*angle, *angle,
*translation, *translation,
@@ -89,7 +89,7 @@ impl ActionData {
} }
} }
ActionData::Animation(AnimeGif::create_png_gif( ActionData::Animation(AnimeGif::create_png_gif(
&file, file,
*scale, *scale,
*angle, *angle,
*translation, *translation,
@@ -107,7 +107,7 @@ impl ActionData {
} => { } => {
if let Some(time) = time { if let Some(time) = time {
return Ok(ActionData::Animation(AnimeGif::create_png_static( return Ok(ActionData::Animation(AnimeGif::create_png_static(
&file, file,
*scale, *scale,
*angle, *angle,
*translation, *translation,
@@ -116,7 +116,7 @@ impl ActionData {
)?)); )?));
} }
// If no time then create a plain static image // If no time then create a plain static image
let image = AnimeImage::from_png(&file, *scale, *angle, *translation, *brightness)?; let image = AnimeImage::from_png(file, *scale, *angle, *translation, *brightness)?;
let data = <AnimeDataBuffer>::from(&image); let data = <AnimeDataBuffer>::from(&image);
ActionData::Image(Box::new(data)) ActionData::Image(Box::new(data))
} }
@@ -157,7 +157,7 @@ impl Sequences {
pub fn iter(&self) -> ActionIterator { pub fn iter(&self) -> ActionIterator {
ActionIterator { ActionIterator {
actions: &self, actions: self,
next_idx: 0, next_idx: 0,
} }
} }
+1 -1
View File
@@ -39,7 +39,7 @@ impl Sequences {
pub fn iter(&self) -> ActionIterator { pub fn iter(&self) -> ActionIterator {
ActionIterator { ActionIterator {
actions: &self, actions: self,
next_idx: 0, next_idx: 0,
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "rog_dbus" name = "rog_dbus"
version = "3.5.0" version = "3.5.1"
license = "MPL-2.0" license = "MPL-2.0"
readme = "README.md" readme = "README.md"
authors = ["Luke <luke@ljones.dev>"] authors = ["Luke <luke@ljones.dev>"]
+1 -1
View File
@@ -37,7 +37,7 @@ pub struct AnimeProxy<'a>(DaemonProxy<'a>);
impl<'a> AnimeProxy<'a> { impl<'a> AnimeProxy<'a> {
#[inline] #[inline]
pub fn new(conn: &Connection) -> Result<Self> { pub fn new(conn: &Connection) -> Result<Self> {
Ok(AnimeProxy(DaemonProxy::new(&conn)?)) Ok(AnimeProxy(DaemonProxy::new(conn)?))
} }
#[inline] #[inline]
+1 -1
View File
@@ -44,7 +44,7 @@ pub struct ChargeProxy<'a>(DaemonProxy<'a>);
impl<'a> ChargeProxy<'a> { impl<'a> ChargeProxy<'a> {
#[inline] #[inline]
pub fn new(conn: &Connection) -> Result<Self> { pub fn new(conn: &Connection) -> Result<Self> {
Ok(ChargeProxy(DaemonProxy::new(&conn)?)) Ok(ChargeProxy(DaemonProxy::new(conn)?))
} }
#[inline] #[inline]
+1 -1
View File
@@ -52,7 +52,7 @@ pub struct GfxProxy<'a>(DaemonProxy<'a>);
impl<'a> GfxProxy<'a> { impl<'a> GfxProxy<'a> {
#[inline] #[inline]
pub fn new(conn: &Connection) -> Result<Self> { pub fn new(conn: &Connection) -> Result<Self> {
Ok(GfxProxy(DaemonProxy::new(&conn)?)) Ok(GfxProxy(DaemonProxy::new(conn)?))
} }
#[inline] #[inline]
+1 -1
View File
@@ -81,7 +81,7 @@ pub struct LedProxy<'a>(DaemonProxy<'a>);
impl<'a> LedProxy<'a> { impl<'a> LedProxy<'a> {
#[inline] #[inline]
pub fn new(conn: &Connection) -> Result<Self> { pub fn new(conn: &Connection) -> Result<Self> {
Ok(LedProxy(DaemonProxy::new(&conn)?)) Ok(LedProxy(DaemonProxy::new(conn)?))
} }
#[inline] #[inline]
+1 -1
View File
@@ -60,7 +60,7 @@ pub struct ProfileProxy<'a>(DaemonProxy<'a>);
impl<'a> ProfileProxy<'a> { impl<'a> ProfileProxy<'a> {
#[inline] #[inline]
pub fn new(conn: &Connection) -> Result<Self> { pub fn new(conn: &Connection) -> Result<Self> {
Ok(ProfileProxy(DaemonProxy::new(&conn)?)) Ok(ProfileProxy(DaemonProxy::new(conn)?))
} }
#[inline] #[inline]
+1 -1
View File
@@ -54,7 +54,7 @@ pub struct RogBiosProxy<'a>(DaemonProxy<'a>);
impl<'a> RogBiosProxy<'a> { impl<'a> RogBiosProxy<'a> {
#[inline] #[inline]
pub fn new(conn: &Connection) -> Result<Self> { pub fn new(conn: &Connection) -> Result<Self> {
Ok(RogBiosProxy(DaemonProxy::new(&conn)?)) Ok(RogBiosProxy(DaemonProxy::new(conn)?))
} }
#[inline] #[inline]
+1 -1
View File
@@ -36,7 +36,7 @@ pub struct SupportProxy<'a>(DaemonProxy<'a>);
impl<'a> SupportProxy<'a> { impl<'a> SupportProxy<'a> {
#[inline] #[inline]
pub fn new(conn: &Connection) -> Result<Self> { pub fn new(conn: &Connection) -> Result<Self> {
Ok(SupportProxy(DaemonProxy::new(&conn)?)) Ok(SupportProxy(DaemonProxy::new(conn)?))
} }
#[inline] #[inline]
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "rog_profiles" name = "rog_profiles"
version = "0.1.1" version = "0.1.2"
authors = ["Luke D. Jones <luke@ljones.dev>"] authors = ["Luke D. Jones <luke@ljones.dev>"]
edition = "2018" edition = "2018"
-4
View File
@@ -6,7 +6,6 @@ use rog_fan_curve::CurveError;
#[derive(Debug)] #[derive(Debug)]
pub enum ProfileError { pub enum ProfileError {
ParseFanLevel, ParseFanLevel,
MissingProfile(String),
Path(String, std::io::Error), Path(String, std::io::Error),
Read(String, std::io::Error), Read(String, std::io::Error),
Write(String, std::io::Error), Write(String, std::io::Error),
@@ -23,9 +22,6 @@ impl fmt::Display for ProfileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self { match self {
ProfileError::ParseFanLevel => write!(f, "Parse profile error"), ProfileError::ParseFanLevel => write!(f, "Parse profile error"),
ProfileError::MissingProfile(profile) => {
write!(f, "Profile does not exist {}", profile)
}
ProfileError::Path(path, error) => write!(f, "Path {}: {}", path, error), ProfileError::Path(path, error) => write!(f, "Path {}: {}", path, error),
ProfileError::Read(path, error) => write!(f, "Read {}: {}", path, error), ProfileError::Read(path, error) => write!(f, "Read {}: {}", path, error),
ProfileError::Write(path, error) => write!(f, "Write {}: {}", path, error), ProfileError::Write(path, error) => write!(f, "Write {}: {}", path, error),
+2
View File
@@ -86,6 +86,7 @@ impl From<GfxVendors> for &str {
pub enum GfxRequiredUserAction { pub enum GfxRequiredUserAction {
Logout, Logout,
Reboot, Reboot,
Integrated,
None, None,
} }
@@ -94,6 +95,7 @@ impl From<&GfxRequiredUserAction> for &str {
match gfx { match gfx {
GfxRequiredUserAction::Logout => "logout", GfxRequiredUserAction::Logout => "logout",
GfxRequiredUserAction::Reboot => "reboot", GfxRequiredUserAction::Reboot => "reboot",
GfxRequiredUserAction::Integrated => "switch to integrated first",
GfxRequiredUserAction::None => "no action", GfxRequiredUserAction::None => "no action",
} }
} }