Skip to content

Commit cb34adf

Browse files
chore: bump pciid-parser and adopt breaking changes
1 parent 8c3a99c commit cb34adf

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lact-daemon/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ divan = { workspace = true, optional = true }
3333

3434
nvml-wrapper = { git = "https://github.com/ilya-zlobintsev/nvml-wrapper", branch = "lact" }
3535
bitflags = "2.6.0"
36-
pciid-parser = { version = "0.7", features = ["serde"] }
36+
pciid-parser = { version = "0.8", features = ["serde"] }
3737
serde_yaml = "0.9"
3838
vulkano = { version = "0.34.1", default-features = false }
3939
zbus = { version = "5.3.1", default-features = false, features = ["tokio"] }

lact-daemon/src/server/gpu_controller.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,17 @@ pub(crate) fn init_controller(
113113
.unwrap_or_default();
114114

115115
let subsystem_info = subsystem_entry
116-
.map(|(subsys_vendor_id, subsys_device_id)| {
117-
pci_db.get_device_info(vendor_id, device_id, subsys_vendor_id, subsys_device_id)
116+
.and_then(|(subsys_vendor_id, subsys_device_id)| {
117+
Some(pci_db.get_device_info(
118+
u16::from_str_radix(vendor_id, 16).ok()?,
119+
u16::from_str_radix(device_id, 16).ok()?,
120+
u16::from_str_radix(subsys_vendor_id, 16).ok()?,
121+
u16::from_str_radix(subsys_device_id, 16).ok()?,
122+
))
118123
})
119124
.unwrap_or_default();
120125

121-
let vendor = pci_db.vendors.get(&vendor_id.to_ascii_lowercase());
126+
let vendor = pci_db.vendors.get(&u16::from_str_radix(vendor_id, 16)?);
122127

123128
let pci_info = GpuPciInfo {
124129
device_pci_info: PciInfo {
@@ -128,7 +133,7 @@ pub(crate) fn init_controller(
128133
model: vendor.and_then(|vendor| {
129134
vendor
130135
.devices
131-
.get(&device_id.to_ascii_lowercase())
136+
.get(&u16::from_str_radix(device_id, 16).ok()?)
132137
.map(|device| device.name.clone())
133138
}),
134139
},

0 commit comments

Comments
 (0)