TIL: Listing PCI devices by their vendor or class
lspci
lists all PCI devices on the machine. This command can also show only devices
from a given vendor and/or specific class.
Vendor in this context is the manufacturer of that device and class is what
kind of hardware it is (Ethernet controller, graphics card, SD card reader,
etc).
That’s what the -d
flag is for. The syntax is
lspci -d [<vendor>]:[<device>][:<class>[:<prog-if>]]
. Each block separated by
colons must be in hexadecimal format. You can omit a block and that means
any device in that category.
For example, to list all devices by AMD/ATI, use the vendor ID 1002
. The
examples below are from my laptop:
$ lspci -d 1002:: # AMD/ATI vendor, any class
07:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Barcelo (rev d1)
07:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Renoir Radeon High Definition Audio Controller
To list all wireless devices, the class is 0280
:
$ lspci -d ::0280 # Any vendor, Wireless class
06:00.0 Network controller: MEDIATEK Corp. MT7922 802.11ax PCI Express Wireless Network Adapter
My laptop is powered by an AMD CPU, so listing all AMD devices (vendor 1022
)
shows a lot of information. To filter all USB controllers (class c03
) by AMD,
we combine the vendor and class:
$ lspci -d 1022::0c03 # AMD vendor, USB controller class
07:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1
07:00.4 USB controller: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1
Note: AMD (1022
) is not AMD/ATI (1002
).
You can check a list of device vendors and classes at the PCI ID Repository.