diff --git a/Base/usr/share/man/man8/lspci.md b/Base/usr/share/man/man8/lspci.md index 3237cc5e70..8816b7902b 100644 --- a/Base/usr/share/man/man8/lspci.md +++ b/Base/usr/share/man/man8/lspci.md @@ -13,6 +13,11 @@ $ lspci lspci is a utility for displaying information about PCI buses in the system and devices connected to them. It shows a brief list of devices. +## Options + +* `-n`, `--numerical`: Don't try to resolve numerical PCI IDs. This is useful when +there is a need to see the actual PCI IDs, or if `/res/pci.ids` file is not available. + ## Files * `/sys/bus/pci` - source of the PCI devices list. diff --git a/Userland/Utilities/lspci.cpp b/Userland/Utilities/lspci.cpp index 0e81c79b19..0c1bfdf853 100644 --- a/Userland/Utilities/lspci.cpp +++ b/Userland/Utilities/lspci.cpp @@ -45,9 +45,6 @@ static u32 convert_sysfs_value_to_uint(String const& value) ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio rpath")); - TRY(Core::System::unveil("/res/pci.ids", "r")); - TRY(Core::System::unveil("/sys/bus/pci", "r")); - TRY(Core::System::unveil(nullptr, nullptr)); Core::ArgsParser args_parser; args_parser.set_general_help("List PCI devices."); @@ -55,6 +52,11 @@ ErrorOr serenity_main(Main::Arguments arguments) args_parser.add_option(flag_verbose, "Show verbose info on devices", "verbose", 'v'); args_parser.parse(arguments); + if (!flag_show_numerical) + TRY(Core::System::unveil("/res/pci.ids", "r")); + TRY(Core::System::unveil("/sys/bus/pci", "r")); + TRY(Core::System::unveil(nullptr, nullptr)); + auto const format = flag_show_numerical ? format_numerical : format_textual; RefPtr db;