Skip to content
Snippets Groups Projects
Commit be9f9014 authored by Martin Kröning's avatar Martin Kröning :crab:
Browse files

Make pci-ids optional

parent 178d4240
No related branches found
No related tags found
No related merge requests found
......@@ -48,10 +48,10 @@ name = "measure_startup_time"
harness = false
[features]
default = ["pci", "acpi", "fsgsbase", "smp"]
default = ["pci", "pci-ids", "acpi", "fsgsbase", "smp"]
vga = []
newlib = []
pci = ["pci-ids"]
pci = []
acpi = []
smp = ["include-transformed"]
fsgsbase = []
......
......@@ -380,8 +380,10 @@ impl fmt::Display for PciBar {
impl fmt::Display for PciAdapter {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[cfg(feature = "pci-ids")]
use pci_ids::{Class, Device, FromId, Subclass};
#[cfg(feature = "pci-ids")]
let class_name = Class::from_id(self.class_id).map_or("Unknown Class", |class| {
class
.subclasses()
......@@ -390,10 +392,14 @@ impl fmt::Display for PciAdapter {
.unwrap_or_else(|| class.name())
});
#[cfg(feature = "pci-ids")]
let (vendor_name, device_name) = Device::from_vid_pid(self.vendor_id, self.device_id)
.map(|device| (device.vendor().name(), device.name()))
.unwrap_or(("Unknown Vendor", "Unknown Device"));
#[cfg(not(feature = "pci-ids"))]
let (class_name, vendor_name, device_name) = ("Unknown Class", "Unknown Vendor", "Unknown Device");
// Output detailed readable information about this device.
write!(
f,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment