mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Bugfix configs
This commit is contained in:
@@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
+ requires a kernel patch which will be upstreamed and in fedora rog kernel
|
+ requires a kernel patch which will be upstreamed and in fedora rog kernel
|
||||||
- Make gfx change from nvidia to vfio/compute also force-change to integrated _then_
|
- Make gfx change from nvidia to vfio/compute also force-change to integrated _then_
|
||||||
to requested mode
|
to requested mode
|
||||||
|
- Fix invalid gfx status when switching from some modes
|
||||||
|
- Fix copy over of serde skipped config values on config reload
|
||||||
|
|
||||||
# [3.6.1] - 2021-05-25
|
# [3.6.1] - 2021-05-25
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -142,24 +142,16 @@ impl Config {
|
|||||||
if l == 0 {
|
if l == 0 {
|
||||||
warn!("File is empty {}", CONFIG_PATH);
|
warn!("File is empty {}", CONFIG_PATH);
|
||||||
} else {
|
} else {
|
||||||
let x: Config = serde_json::from_str(&buf)
|
let mut x: Config = serde_json::from_str(&buf)
|
||||||
.unwrap_or_else(|_| panic!("Could not deserialise {}", CONFIG_PATH));
|
.unwrap_or_else(|_| panic!("Could not deserialise {}", CONFIG_PATH));
|
||||||
|
// copy over serde skipped values
|
||||||
|
x.gfx_tmp_mode = self.gfx_tmp_mode;
|
||||||
|
x.curr_fan_mode = self.curr_fan_mode;
|
||||||
*self = x;
|
*self = x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_new() -> Result<Config, Box<dyn std::error::Error>> {
|
|
||||||
let mut file = OpenOptions::new()
|
|
||||||
.read(true)
|
|
||||||
.open(&CONFIG_PATH)
|
|
||||||
.unwrap_or_else(|err| panic!("Error reading {}: {}", CONFIG_PATH, err));
|
|
||||||
let mut buf = String::new();
|
|
||||||
file.read_to_string(&mut buf)?;
|
|
||||||
let x: Config = serde_json::from_str(&buf)?;
|
|
||||||
Ok(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn write(&self) {
|
pub fn write(&self) {
|
||||||
let mut file = File::create(CONFIG_PATH).expect("Couldn't overwrite config");
|
let mut file = File::create(CONFIG_PATH).expect("Couldn't overwrite config");
|
||||||
let json = serde_json::to_string_pretty(self).expect("Parse config to JSON failed");
|
let json = serde_json::to_string_pretty(self).expect("Parse config to JSON failed");
|
||||||
|
|||||||
@@ -538,18 +538,15 @@ 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 vfio_enable = if let Ok(mut config) = config.try_lock() {
|
let mut mode_to_save = vendor;
|
||||||
|
// Need to change to integrated before we can change to vfio or compute
|
||||||
|
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
|
||||||
// for Integrated, Hybrid, or Nvidia. Tmp is also only for informational
|
// for Integrated, Hybrid, or Nvidia. Tmp is also only for informational
|
||||||
config.gfx_tmp_mode = None;
|
config.gfx_tmp_mode = None;
|
||||||
//
|
//
|
||||||
config.gfx_vfio_enable
|
let vfio_enable = config.gfx_vfio_enable;
|
||||||
} else {
|
|
||||||
false
|
|
||||||
};
|
|
||||||
|
|
||||||
// Need to change to integrated before we can change to vfio or compute
|
|
||||||
if let Ok(config) = config.try_lock() {
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -557,14 +554,16 @@ impl CtrlGraphics {
|
|||||||
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
|
sleep(Duration::from_millis(1000)); // Allow some time for the desktop to start
|
||||||
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
|
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
|
||||||
|
config.gfx_tmp_mode = Some(vendor);
|
||||||
|
mode_to_save = GfxVendors::Integrated;
|
||||||
|
} else {
|
||||||
|
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
|
||||||
|
Self::do_display_manager_action("restart")?;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?;
|
|
||||||
Self::do_display_manager_action("restart")?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save selected mode in case of reboot
|
// Save selected mode in case of reboot
|
||||||
Self::save_gfx_mode(vendor, config);
|
Self::save_gfx_mode(mode_to_save, config);
|
||||||
info!("GFX thread: display-manager started");
|
info!("GFX thread: display-manager started");
|
||||||
|
|
||||||
let v: &str = vendor.into();
|
let v: &str = vendor.into();
|
||||||
|
|||||||
Reference in New Issue
Block a user