Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
bc090fa9b2 | |||
86cf230f21 | |||
fefcbe4373 |
2 changed files with 2 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "phenix"
|
name = "phenix"
|
||||||
description = "Utility to restart PCIe devices when link is lost."
|
description = "Utility to restart PCIe devices when link is lost."
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
repository="https://code.edgarpierre.fr/edpibu/phenix"
|
repository="https://code.edgarpierre.fr/edpibu/phenix"
|
||||||
|
|
|
@ -25,7 +25,6 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn manage_line(line: String) {
|
fn manage_line(line: String) {
|
||||||
dbg!(&line);
|
|
||||||
if let Some((prefix, line)) = line.split_once(";") {
|
if let Some((prefix, line)) = line.split_once(";") {
|
||||||
if line.ends_with("PCIe link lost") {
|
if line.ends_with("PCIe link lost") {
|
||||||
println!("PCIe link lost {prefix}");
|
println!("PCIe link lost {prefix}");
|
||||||
|
@ -42,6 +41,7 @@ fn manage_line(line: String) {
|
||||||
fn reset_device(id: &str) {
|
fn reset_device(id: &str) {
|
||||||
println!("Resetting {id}");
|
println!("Resetting {id}");
|
||||||
echo1(rm_file_path(&id));
|
echo1(rm_file_path(&id));
|
||||||
|
println!("Removed device {id}");
|
||||||
echo1(String::from("/sys/bus/pci/rescan"));
|
echo1(String::from("/sys/bus/pci/rescan"));
|
||||||
println!("Rescanned PCI bus");
|
println!("Rescanned PCI bus");
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,6 @@ fn echo1(path: String) {
|
||||||
Ok(mut file) => {
|
Ok(mut file) => {
|
||||||
file.write_all(b"1")
|
file.write_all(b"1")
|
||||||
.expect("Failed to write to remove file");
|
.expect("Failed to write to remove file");
|
||||||
println!("Removed device {path}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue