feat(linux-gpu): handle the return value of the pci_fill_info function

This commit is contained in:
utox39
2025-07-11 16:27:07 +02:00
parent a52dd145da
commit 90abbcb1fd

View File

@@ -100,8 +100,11 @@ pub fn getGpuInfo(allocator: std.mem.Allocator) !GpuInfo {
var devices = pacc.*.devices; var devices = pacc.*.devices;
while (devices != null) : (devices = devices.*.next) { while (devices != null) : (devices = devices.*.next) {
// TODO: handle return value // NOTE: for references: https://github.com/pciutils/pciutils/blob/3ec74c71c01878f92e751f15bb8febe720c3ab40/lib/access.c#L194
_ = c_libpci.pci_fill_info(devices, c_libpci.PCI_FILL_IDENT | c_libpci.PCI_FILL_CLASS); const known_fields = c_libpci.pci_fill_info(devices, c_libpci.PCI_FILL_IDENT | c_libpci.PCI_FILL_CLASS);
if (known_fields <= 0) {
return error.NoLibpciFieldsFound;
}
if ((devices.*.device_class >> 8) == display_controller) { if ((devices.*.device_class >> 8) == display_controller) {
var name_buffer: [256]u8 = undefined; var name_buffer: [256]u8 = undefined;