Read vendor and device IDs from sysfs and format as `"VVVV DDDD"` (no `0x` prefix).
(&self)
| 153 | |
| 154 | /// Read vendor and device IDs from sysfs and format as `"VVVV DDDD"` (no `0x` prefix). |
| 155 | pub(crate) fn vfio_id_string(&self) -> Option<String> { |
| 156 | let vendor = self.vendor().ok()?; |
| 157 | let device = self.device_id().ok()?; |
| 158 | let vendor_hex = vendor.strip_prefix("0x").unwrap_or(&vendor); |
| 159 | let device_hex = device.strip_prefix("0x").unwrap_or(&device); |
| 160 | Some(format!("{vendor_hex} {device_hex}")) |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | /// Validate a PCI BDF address (format `DDDD:BB:DD.F`). |
no test coverage detected