Skip to content

Commit

Permalink
Added support for systems with multiple PCI interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlexDev23 committed Sep 14, 2024
1 parent 35bd83f commit 005eab5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
12 changes: 2 additions & 10 deletions crates/power-daemon/src/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ impl ASPMSettings {
pub struct PCISettings {
pub enable_power_management: Option<bool>,
// whitelist or blacklist device to exlude/include.
// Should be the name of the device under /sys/bus/pci/devices excluding the beggining 0000:
// Should be the name of the device under /sys/bus/pci/devices
pub whiteblacklist: Option<WhiteBlackList>,
}

Expand All @@ -638,17 +638,9 @@ impl PCISettings {
let entry = entry.expect("Could not read sysfs entry");
let path = entry.path();

let device_name = path
.file_name()
.unwrap()
.to_str()
.unwrap()
.strip_prefix("0000:")
.unwrap();

let enable_pm = WhiteBlackList::should_enable_item(
&self.whiteblacklist,
device_name,
path.file_name().unwrap().to_str().unwrap(),
self.enable_power_management.unwrap(),
);

Expand Down
8 changes: 1 addition & 7 deletions crates/power-daemon/src/systeminfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,7 @@ impl PCIInfo {
))
.0;

let pci_address = device
.file_name()
.into_string()
.unwrap()
.strip_prefix("0000:")
.unwrap()
.to_string();
let pci_address = device.file_name().into_string().unwrap();

pci_devices.push(PCIDeviceInfo {
display_name,
Expand Down

0 comments on commit 005eab5

Please sign in to comment.