Better control of gfx modes

This commit is contained in:
Luke D. Jones
2021-06-11 09:03:50 +12:00
parent 226620eb53
commit baebd51d99
6 changed files with 21 additions and 18 deletions

View File

@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
# [3.7.1] - 2021-06-11
### Changed
- Refine graphics mode switching:
+ Disallow switching to compute or vfio mode unless existing mode is "Integrated"

2
Cargo.lock generated
View File

@@ -206,7 +206,7 @@ dependencies = [
[[package]]
name = "daemon"
version = "3.7.0"
version = "3.7.1"
dependencies = [
"env_logger",
"log",

View File

@@ -10,10 +10,13 @@ use rog_anime::{AnimeDataBuffer, AnimeImage, Vec2, ANIME_DATA_LEN};
use rog_aura::{self, AuraEffect};
use rog_dbus::RogDbusClient;
use rog_profiles::profiles::Profile;
use rog_types::{gfx_vendors::{GfxRequiredUserAction, GfxVendors}, supported::{
use rog_types::{
gfx_vendors::{GfxRequiredUserAction, GfxVendors},
supported::{
FanCpuSupportedFunctions, LedSupportedFunctions, RogBiosSupportedFunctions,
SupportedFunctions,
}};
},
};
use std::{env::args, path::Path};
use yansi_term::Colour::Green;
use yansi_term::Colour::Red;
@@ -312,20 +315,17 @@ fn do_gfx(
"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)
);
},
println!("Graphics mode changed to {}", <&str>::from(mode));
}
}
std::process::exit(0)
}

View File

@@ -1,6 +1,6 @@
[package]
name = "daemon"
version = "3.7.0"
version = "3.7.1"
license = "MPL-2.0"
readme = "README.md"
authors = ["Luke <luke@ljones.dev>"]

View File

@@ -662,7 +662,7 @@ impl CtrlGraphics {
let bus = self.bus.clone();
Self::do_mode_setup_tasks(vendor, vfio_enable, &devices, &bus)?;
info!("GFX: Graphics mode changed to {}", <&str>::from(vendor));
},
}
GfxRequiredUserAction::Integrated => {
info!("GFX: mode change requires user to be in Integrated mode first");
}

View File

@@ -17,11 +17,11 @@ use rog_aura::{
AuraEffect, LedBrightness, LED_MSG_LEN,
};
use rog_types::supported::LedSupportedFunctions;
use std::{fs::OpenOptions, thread::spawn};
use std::io::{Read, Write};
use std::path::Path;
use std::sync::Arc;
use std::sync::Mutex;
use std::{fs::OpenOptions, thread::spawn};
use zbus::Connection;
use crate::GetSupported;
@@ -75,12 +75,13 @@ impl<'a> CtrlKbdLedTask<'a> {
// wait a fraction for things to wake up properly
//std::thread::sleep(Duration::from_millis(100));
loop {
if let Ok(ref mut lock) = c1.try_lock() {
lock.set_brightness(lock.config.brightness).ok();
break;
}}
if let Ok(ref mut lock) = c1.try_lock() {
lock.set_brightness(lock.config.brightness).ok();
break;
}
}
});
}
}
Ok(())
})
.map_err(|err| {