From 9a28ef7aa939e3d939258c8f282ae295bb7607da Mon Sep 17 00:00:00 2001 From: Undefine Date: Mon, 17 Jan 2022 13:08:12 +0100 Subject: [PATCH] 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 --- Userland/Applications/SystemMonitor/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index 07d3c9708f..e05654c838 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -626,14 +626,14 @@ NonnullRefPtr 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 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,