Skip to content

Commit

Permalink
chwd: Remove dead code (#137)
Browse files Browse the repository at this point in the history
Signed-off-by: Vasiliy Stelmachenok <[email protected]>
  • Loading branch information
ventureoo authored Sep 28, 2024
1 parent 2e46959 commit 0dfa0c6
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,36 +271,6 @@ pub fn run_script(
cmd.push_str(&format!(" --pmroot \"{}\"", args.pmroot));
cmd.push_str(&format!(" --profile \"{}\"", profile.name));
cmd.push_str(&format!(" --path \"{}\"", profile.prof_path));

// Set all profiles devices as argument
let devices = &data.pci_devices;
let found_devices = data::get_all_devices_of_profile(&data.pci_devices, profile)
.into_iter()
.map(|index| devices.get(index).unwrap().clone())
.collect::<Vec<device::Device>>();

// Get only unique ones from found devices
let devices = device::get_unique_devices(&found_devices);
for dev in devices.iter() {
let bus_id = dev.sysfs_busid.replace('.', ":");
let split = bus_id.split(':').collect::<Vec<_>>();
let split_size = split.len();
let bus_id = if split_size >= 3 {
// Convert to int to remove leading 0
format!(
"{}:{}:{}",
i64::from_str_radix(split[split_size - 3], 16).unwrap(),
i64::from_str_radix(split[split_size - 2], 16).unwrap(),
i64::from_str_radix(split[split_size - 1], 16).unwrap()
)
} else {
dev.sysfs_busid.clone()
};
cmd.push_str(&format!(
" --device \"{}|{}|{}|{}\"",
dev.class_id, dev.vendor_id, dev.device_id, bus_id
));
}
cmd.push_str(" 2>&1");

let status = Exec::shell(cmd).join();
Expand Down

0 comments on commit 0dfa0c6

Please sign in to comment.