:sadface:

This commit is contained in:
Luke D Jones
2021-03-10 16:43:15 +13:00
parent ebe7e61355
commit a678f54f59
2 changed files with 6 additions and 20 deletions

View File

@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- Notify through dbus if user changes profile manually
- Better help on CLI, show help only for supported items
- Bugfix to gfx switcher
# [3.1.3] - 2021-03-10
### Changed

View File

@@ -261,20 +261,13 @@ impl CtrlGraphics {
}
fn do_driver_action(driver: &str, action: &str) -> Result<(), RogError> {
let mut cmd;
if Self::kmod_exists() {
info!("using kmod");
cmd = Command::new("kmod");
cmd.arg(action);
} else {
cmd = Command::new(action);
}
let mut cmd= Command::new(action);
cmd.arg(driver);
let mut count = 0;
const MAX_TRIES: i32 = 6;
loop {
if count > MAX_TRIES+1 {
if count > MAX_TRIES {
let msg = format!("{} {} failed for unknown reason", action, driver);
error!("{}", msg);
return Ok(()) //Err(RogError::Modprobe(msg));
@@ -297,6 +290,8 @@ impl CtrlGraphics {
let msg = format!("{} {} failed: {:?}", action, driver, String::from_utf8_lossy(&output.stderr));
return Err(RogError::Modprobe(msg));
}
} else if output.status.success() {
return Ok(())
}
count += 1;
@@ -344,17 +339,6 @@ impl CtrlGraphics {
);
}
fn kmod_exists() -> bool {
let mut cmd = Command::new("which");
cmd.arg("kmod");
if let Ok(output) = cmd
.output() {
return output.status.success() && output.stdout.ends_with("kmod".as_bytes())
}
//Path::new("/usr/bin/kmod").exists()
false
}
pub fn do_vendor_tasks(&mut self, vendor: GfxVendors) -> Result<(), RogError> {
Self::write_xorg_conf(vendor)?;
Self::write_modprobe_conf()?; // TODO: Not required here, should put in startup?