mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Hotfix: try to handle module remove gracefully
Try to handle module remove more gracefully if in-use when the display manager is shutting down
This commit is contained in:
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
# [3.1.3] - 2021-03-10
|
||||||
|
### Changed
|
||||||
|
- Hotfix: gracefully handle removing modules in use caused by display-manager not
|
||||||
|
fully shutdown at the time of trying to remove modules. It will now retry every
|
||||||
|
250ms per module
|
||||||
|
|
||||||
# [3.1.2] - 2021-03-10
|
# [3.1.2] - 2021-03-10
|
||||||
### Changed
|
### Changed
|
||||||
- Test and create /etc/X11/xorg.conf.d/ if it doesn't exist
|
- Test and create /etc/X11/xorg.conf.d/ if it doesn't exist
|
||||||
|
|||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -187,7 +187,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "daemon"
|
name = "daemon"
|
||||||
version = "3.1.2"
|
version = "3.1.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"intel-pstate",
|
"intel-pstate",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "daemon"
|
name = "daemon"
|
||||||
version = "3.1.2"
|
version = "3.1.3"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = ["Luke <luke@ljones.dev>"]
|
authors = ["Luke <luke@ljones.dev>"]
|
||||||
|
|||||||
@@ -271,23 +271,37 @@ impl CtrlGraphics {
|
|||||||
}
|
}
|
||||||
cmd.arg(driver);
|
cmd.arg(driver);
|
||||||
|
|
||||||
let output = cmd
|
let mut count = 0;
|
||||||
.output()
|
const MAX_TRIES: i32 = 6;
|
||||||
.map_err(|err| RogError::Command(format!("{:?}", cmd), err))?;
|
loop {
|
||||||
if !output.status.success() {
|
if count > MAX_TRIES {
|
||||||
if output.stderr.ends_with("is not currently loaded\n".as_bytes()) {
|
let msg = format!("{} {} failed for unknown reason", action, driver);
|
||||||
return Ok(())
|
error!("{}", msg);
|
||||||
|
return Ok(()) //Err(RogError::Modprobe(msg));
|
||||||
}
|
}
|
||||||
if output.stderr.ends_with("Permission denied\n".as_bytes()) {
|
|
||||||
let msg = format!("{} {} failed: {:?}", action, driver, String::from_utf8_lossy(&output.stderr));
|
let output = cmd
|
||||||
warn!("{}", msg);
|
.output()
|
||||||
warn!("It may be safe to ignore the above error, run `lsmod |grep nvidia` to confirm modules loaded");
|
.map_err(|err| RogError::Command(format!("{:?}", cmd), err))?;
|
||||||
return Ok(())
|
if !output.status.success() {
|
||||||
|
if output.stderr.ends_with("is not currently loaded\n".as_bytes()) {
|
||||||
|
return Ok(())
|
||||||
|
}
|
||||||
|
if output.stderr.ends_with("Permission denied\n".as_bytes()) {
|
||||||
|
let msg = format!("{} {} failed: {:?}", action, driver, String::from_utf8_lossy(&output.stderr));
|
||||||
|
warn!("{}", msg);
|
||||||
|
warn!("It may be safe to ignore the above error, run `lsmod |grep nvidia` to confirm modules loaded");
|
||||||
|
return Ok(())
|
||||||
|
}
|
||||||
|
if count == MAX_TRIES {
|
||||||
|
let msg = format!("{} {} failed: {:?}", action, driver, String::from_utf8_lossy(&output.stderr));
|
||||||
|
return Err(RogError::Modprobe(msg));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let msg = format!("{} {} failed: {:?}", action, driver, String::from_utf8_lossy(&output.stderr));
|
|
||||||
return Err(RogError::Modprobe(msg));
|
count += 1;
|
||||||
|
std::thread::sleep(std::time::Duration::from_millis(250));
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_display_manager_action(action: &str) -> Result<(), RogError> {
|
fn do_display_manager_action(action: &str) -> Result<(), RogError> {
|
||||||
|
|||||||
Reference in New Issue
Block a user