diff --git a/CHANGELOG.md b/CHANGELOG.md index ec097ea1..9683a38c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed - Add GX550L led modes +- Don't save compute/vfio modes. Option in config for this is removed. # [3.5.2] - 2021-05-15 ### Changed diff --git a/daemon/src/config.rs b/daemon/src/config.rs index 55b39aa8..a9d3f155 100644 --- a/daemon/src/config.rs +++ b/daemon/src/config.rs @@ -17,7 +17,6 @@ pub struct Config { pub gfx_last_mode: GfxVendors, pub gfx_managed: bool, pub gfx_vfio_enable: bool, - pub gfx_save_compute_vfio: bool, pub active_profile: String, pub toggle_profiles: Vec, #[serde(skip)] @@ -38,7 +37,6 @@ impl Default for Config { gfx_last_mode: GfxVendors::Hybrid, gfx_managed: true, gfx_vfio_enable: false, - gfx_save_compute_vfio: true, active_profile: "normal".into(), toggle_profiles: vec!["normal".into(), "boost".into(), "silent".into()], curr_fan_mode: 0, @@ -69,6 +67,11 @@ impl Config { } else { if let Ok(data) = serde_json::from_str(&buf) { return data; + } else if let Ok(data) = serde_json::from_str::(&buf) { + let config = data.into_current(); + config.write(); + info!("Updated config version to: {}", VERSION); + return config; } else if let Ok(data) = serde_json::from_str::(&buf) { let config = data.into_current(); config.write(); diff --git a/daemon/src/config_old.rs b/daemon/src/config_old.rs index 2b8ac136..e6ebb023 100644 --- a/daemon/src/config_old.rs +++ b/daemon/src/config_old.rs @@ -28,7 +28,6 @@ impl ConfigV317 { gfx_last_mode: GfxVendors::Hybrid, gfx_managed: self.gfx_managed, gfx_vfio_enable: false, - gfx_save_compute_vfio: false, active_profile: self.active_profile, toggle_profiles: self.toggle_profiles, curr_fan_mode: self.curr_fan_mode, @@ -57,7 +56,6 @@ impl ConfigV324 { gfx_last_mode: GfxVendors::Hybrid, gfx_managed: self.gfx_managed, gfx_vfio_enable: false, - gfx_save_compute_vfio: false, active_profile: self.active_profile, toggle_profiles: self.toggle_profiles, curr_fan_mode: self.curr_fan_mode, @@ -87,7 +85,6 @@ impl ConfigV341 { gfx_last_mode: GfxVendors::Hybrid, gfx_managed: self.gfx_managed, gfx_vfio_enable: false, - gfx_save_compute_vfio: false, active_profile: self.active_profile, toggle_profiles: self.toggle_profiles, curr_fan_mode: self.curr_fan_mode, @@ -96,3 +93,35 @@ impl ConfigV341 { } } } + + +#[derive(Deserialize, Serialize)] +pub struct ConfigV352 { + pub gfx_mode: GfxVendors, + pub gfx_last_mode: GfxVendors, + pub gfx_managed: bool, + pub gfx_vfio_enable: bool, + pub gfx_save_compute_vfio: bool, + pub active_profile: String, + pub toggle_profiles: Vec, + #[serde(skip)] + pub curr_fan_mode: u8, + pub bat_charge_limit: u8, + pub power_profiles: BTreeMap, +} + +impl ConfigV352 { + pub(crate) fn into_current(self) -> Config { + Config { + gfx_mode: GfxVendors::Hybrid, + gfx_last_mode: GfxVendors::Hybrid, + gfx_managed: self.gfx_managed, + gfx_vfio_enable: false, + active_profile: self.active_profile, + toggle_profiles: self.toggle_profiles, + curr_fan_mode: self.curr_fan_mode, + bat_charge_limit: self.bat_charge_limit, + power_profiles: self.power_profiles, + } + } +} \ No newline at end of file diff --git a/daemon/src/ctrl_gfx/controller.rs b/daemon/src/ctrl_gfx/controller.rs index ec5af564..6de3d42b 100644 --- a/daemon/src/ctrl_gfx/controller.rs +++ b/daemon/src/ctrl_gfx/controller.rs @@ -607,16 +607,6 @@ impl CtrlGraphics { let bus = self.bus.clone(); Self::do_vendor_tasks(vendor, vfio_enable, &devices, &bus)?; info!("GFX: Graphics mode changed to {}", <&str>::from(vendor)); - if matches!(vendor, GfxVendors::Compute | GfxVendors::Vfio) { - loop { - if let Ok(config) = self.config.try_lock() { - if config.gfx_save_compute_vfio { - Self::save_gfx_mode(vendor, self.config.clone()); - } - return Ok(action_required); - } - } - } } // TODO: undo if failed? Save last mode, catch errors... Ok(action_required)