diff --git a/lact-daemon/src/server/gpu_controller/amd.rs b/lact-daemon/src/server/gpu_controller/amd.rs index c5bf27b..cc28b27 100644 --- a/lact-daemon/src/server/gpu_controller/amd.rs +++ b/lact-daemon/src/server/gpu_controller/amd.rs @@ -55,6 +55,7 @@ pub struct AmdGpuController { } impl AmdGpuController { + #[allow(unused_variables)] pub fn new_from_path( common: CommonControllerInfo, libdrm_amdgpu: Option<&LibDrmAmdgpu>, diff --git a/lact-daemon/src/server/gpu_controller/mod.rs b/lact-daemon/src/server/gpu_controller/mod.rs index 60822e2..55225ab 100644 --- a/lact-daemon/src/server/gpu_controller/mod.rs +++ b/lact-daemon/src/server/gpu_controller/mod.rs @@ -110,17 +110,17 @@ pub(crate) fn init_controller( }) .unwrap_or_default(); - let vendor_entry = pci_db.vendors.get_key_value(vendor_id); + let vendor = pci_db.vendors.get(&vendor_id.to_ascii_lowercase()); let pci_info = GpuPciInfo { device_pci_info: PciInfo { vendor_id: vendor_id.to_owned(), - vendor: vendor_entry.map(|(vendor_name, _)| vendor_name.clone()), + vendor: vendor.map(|vendor| vendor.name.clone()), model_id: device_id.to_owned(), - model: vendor_entry.and_then(|(_, vendor)| { + model: vendor.and_then(|vendor| { vendor .devices - .get(device_id) + .get(&device_id.to_ascii_lowercase()) .map(|device| device.name.clone()) }), }, diff --git a/lact-daemon/src/server/handler.rs b/lact-daemon/src/server/handler.rs index ca91451..b2f6a86 100644 --- a/lact-daemon/src/server/handler.rs +++ b/lact-daemon/src/server/handler.rs @@ -921,6 +921,7 @@ fn load_controllers(base_path: &Path) -> anyhow::Result>> = LazyCell::new(|| match Nvml::init() { Ok(nvml) => { info!("Nvidia management library loaded"); @@ -931,7 +932,10 @@ fn load_controllers(base_path: &Path) -> anyhow::Result>> = LazyCell::new(|| None); + #[cfg(not(test))] let amd_drm: LazyCell> = LazyCell::new(|| match LibDrmAmdgpu::new() { Ok(drm) => { info!("AMDGPU DRM initialized"); @@ -942,6 +946,8 @@ fn load_controllers(base_path: &Path) -> anyhow::Result> = LazyCell::new(|| None); for entry in base_path .read_dir()