mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Try to handle fan-mode fail better
This commit is contained in:
@@ -97,7 +97,11 @@ impl RogCore {
|
|||||||
pub async fn fan_mode_reload(&mut self, config: &mut Config) -> Result<(), Box<dyn Error>> {
|
pub async fn fan_mode_reload(&mut self, config: &mut Config) -> Result<(), Box<dyn Error>> {
|
||||||
let path = RogCore::get_fan_path()?;
|
let path = RogCore::get_fan_path()?;
|
||||||
let mut file = OpenOptions::new().write(true).open(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)?;
|
self.set_pstate_for_fan_mode(FanLevel::from(config.fan_mode), config)?;
|
||||||
info!("Reloaded last saved settings");
|
info!("Reloaded last saved settings");
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -53,7 +53,11 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Reload settings
|
// 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(
|
let mut led_writer = LedWriter::new(
|
||||||
rogcore.get_raw_device_handle(),
|
rogcore.get_raw_device_handle(),
|
||||||
laptop.led_endpoint(),
|
laptop.led_endpoint(),
|
||||||
|
|||||||
Reference in New Issue
Block a user