Try to handle fan-mode fail better

This commit is contained in:
Luke
2020-05-06 07:38:35 +12:00
parent 4d7bc77dff
commit 497ba61d22
2 changed files with 10 additions and 2 deletions

View File

@@ -97,7 +97,11 @@ impl RogCore {
pub async fn fan_mode_reload(&mut self, config: &mut Config) -> Result<(), Box<dyn Error>> {
let path = RogCore::get_fan_path()?;
let mut file = OpenOptions::new().write(true).open(path)?;
file.write_all(format!("{:?}\n", config.fan_mode).as_bytes())?;
file.write_all(format!("{:?}\n", config.fan_mode).as_bytes())
.map_err(|err| {
error!("Could not write fan mode: {:?}", err);
})
.unwrap();
self.set_pstate_for_fan_mode(FanLevel::from(config.fan_mode), config)?;
info!("Reloaded last saved settings");
Ok(())

View File

@@ -53,7 +53,11 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
);
// Reload settings
rogcore.fan_mode_reload(&mut config).await?;
rogcore
.fan_mode_reload(&mut config)
.await
.map_err(|err| warn!("Fan mode: {}", err))
.unwrap();
let mut led_writer = LedWriter::new(
rogcore.get_raw_device_handle(),
laptop.led_endpoint(),