1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

SystemMonitor: Show unknown in PCI devices

In case when the PCI class, device or vendor is unknown, show
that it is unknown instead of just putting the ID
This commit is contained in:
Undefine 2022-01-17 13:08:12 +01:00 committed by Brian Gianforcaro
parent fa1d07a45d
commit 9a28ef7aa9

View file

@ -626,14 +626,14 @@ NonnullRefPtr<GUI::Widget> build_hardware_tab()
[db](const JsonObject& object) {
auto class_id = object.get("class").to_u32();
String class_name = db ? db->get_class(class_id) : nullptr;
return class_name.is_empty() ? String::formatted("{:04x}", class_id) : class_name;
return class_name.is_empty() ? String::formatted("Unknown class: {:04x}", class_id) : class_name;
});
pci_fields.empend(
"Vendor", Gfx::TextAlignment::CenterLeft,
[db](const JsonObject& object) {
auto vendor_id = object.get("vendor_id").to_u32();
String vendor_name = db ? db->get_vendor(vendor_id) : nullptr;
return vendor_name.is_empty() ? String::formatted("{:02x}", vendor_id) : vendor_name;
return vendor_name.is_empty() ? String::formatted("Unknown vendor: {:02x}", vendor_id) : vendor_name;
});
pci_fields.empend(
"Device", Gfx::TextAlignment::CenterLeft,
@ -641,7 +641,7 @@ NonnullRefPtr<GUI::Widget> build_hardware_tab()
auto vendor_id = object.get("vendor_id").to_u32();
auto device_id = object.get("device_id").to_u32();
String device_name = db ? db->get_device(vendor_id, device_id) : nullptr;
return device_name.is_empty() ? String::formatted("{:02x}", device_id) : device_name;
return device_name.is_empty() ? String::formatted("Unknown device: {:02x}", device_id) : device_name;
});
pci_fields.empend(
"Revision", Gfx::TextAlignment::CenterRight,