skip to main content

How to Correct the Missing Device Names of PCI and USB Devices under Linux

Planning / Implementation

Home
Top
Author
Published
4 Mar 2023
Form Number
LP1704
PDF size
8 pages, 650 KB

Abstract

With the fast development of science and technology, customers have higher and higher requirements for server performance. Therefore, multiple hardware generations are launched in quick succession. When a customer installs a new device in a server under Linux operating system, he or she may see the invalid device information because the release date of the device is newer than the release date of the operating system.

This paper provides a brief introduction about how to detect and fix the missing/incomplete naming of the new PCI and USB devices. Our instructions are based on SUSE Linux Enterprise Server 15 SP2 running on a Lenovo ThinkSystem server, however the instructions are also relevant to Red Hat and Ubuntu. This paper is intended for IT administrators and quality assurance engineers. Readers are expected to have a basic knowledge of Linux.

Introduction

Missing/incomplete device names can cause misunderstanding and suspicion for customers. This section will explain the origin of device name clearly and provide the solution accordingly.

PCI device names

  In this section, we provide a guide to introduce the origin of the name about PCI device and how to correct the missing name definition in Linux OSes.

PCI ID Repository

There is an open-source project: The PCI ID Repository, which is a public repository of all known IDs used in PCI devices: IDs of vendors, devices, subsystems and device classes for various programs (e.g., The PCI Utilities) to display full human-readable names instead of hexadecimal code. Everyone can browse the latest database and download the latest database in form of a pci.ids file.

For different Linux distributions, there may have multiple pci.ids files in your operating system in different locations. To find out the actual pci.ids you are using, you need to install a debugging tool named strace.

  1. Install the strace tool.


    Figure 1. Install strace

  2. Execute strace command with lspci commands. The following screenshot indicates that the database is located in /usr/share/pci.ids.


    Figure 2. Running strace to find pci.ids files

Finding the PCI device name

Each PCI device typically has a vendor & device ID indicating the chip and a subvendor & subdevice ID (collectively called subsystem) indicating the board on which the chip resides. There should be one line for each device vendor & device ID and subsystem ID in the naming file. You can get the device information with the steps below:

  1. Grab the device domain information (The first column of output is domain). We will use “5b:00.0” for the example:


    Figure 3. Get the device domain information

  2. Get the vendor and device ID and subsystem information.


    Figure 4. Get the vendor and device ID and subsystem information

  3. Check the name definition in your OS.


    Figure 5. Checking the database

Based on the above output, vendor id (1000), device id (00af) and subvendor id are available in the database while subdevice id is not available.


Figure 6. Determine the current name of the device

Modifying the PCI device name

There are two alternatives to updating the PCI device name.

The easiest way is to run the update-pciids command if the missing data is available in PCI ID repository. This requires your machine to be able to access the Internet. The following screenshot shows the subdevice information available after the database is updated from the Internet.


Figure 7. Using update-pciids to update the device name

If your system doesn't have internet access then you can manually update the database. If PCI ID repository does not include a device ID, please consult the device vendor and add one-line information to the database.

Open the pci.ids file using the vi/vim commands, find the line of device ID “00af” and add the definition of subdevice ID below, then save it.


Figure 8. Adding the new device name

USB device names

  In this section, we provide a guide to introduce the origin of the name of USB device and how to correct it to the expected name in Linux OSes.

USB ID Repository

There is an open-source project: The USB ID Repository, which is a public repository of all known ID's used in USB devices: ID's of vendors, devices, subsystems and device classes. It is used in various programs (e.g., The USB Utilities) to display full human-readable names instead of hexadecimal codes. Everyone can browse the latest database list and download the latest database in form of a usb.ids file.

For the early build of USB Utilities (lsusb), which uses the file usb.ids directly for USB device naming, we can use the tool “strace” to locate the path to USB database (usb.ids) in Ubuntu 18.04:


Figure 9. Use strace to locate the usb.ids file

Note that the database usb.ids is not used anymore since Sep 30, 2019.Instead, udev hardware database is used.


Figure 10. Using strace to locate the hwdb.bin file

According to the output of the command “man hwdb”, hwdb.bin is generated after systemd-hwdb reads all the */hwdb.d/*.hwdb. The file “20-usb-vendor-model.hwdb” is for the USB device naming file imported from: http://www.linux-usb.org/usb.ids.

Thus, all the USB names always come from USB ID Repository in different ways.

Finding the USB device name

Each USB device typically has a vendor & device ID indicating the chip. There should be one line for vendor & device ID about each device in the naming file. You can get the device information with the steps below:

  1. Grab the USB device ID (After the keyword “ID”).


    Figure 11. Get the USB device ID

  2. Check the definition about vendor & device ID “2a4b:0400” and “1d6b:0003” in the file /lib/udev/hwdb.d/20-usb-vendor-model.hwdb and usb.ids.


    Figure 12. Check the USB device definition (udev hardware database)

The above is about the format of the udev hardware database. The following image shows the format of usb.ids:


Figure 13. Check the USB device definition (usb.ids file)

There is no information about vendor 2a4b in either usb.ids or hardware database.

Modifying the USB device name

The process to modify the USB device name depends on the USB database:

For original usb.ids naming: Run the update-usbids command if the missing data is available in USB ID repository. This requires your machine to be access the Internet. The following screenshot shows the vendor and device information available after the database is updated from the Internet.


Figure 14. update-usbids command

For udev hardware database naming, find out the standard definitions in the USB ID repository and add them to file /lib/udev/hwdb.d/20-usb-vendor-model.hwdb, for example below:


Figure 15. Updating the device name with the udev database

The following screenshot shows the vendor and device information available after rebuilding the file hwdb.bin.


Figure 16. Checking the updated name

Note: If USB ID repository does not include a vendor/device ID, please consult the device vendor and add one-line information to the database.

Author

Song Shang is a Linux Engineer in Lenovo Infrastructure Solutions Group, based in Beijing, China.

Related product families

Product families related to this document are the following:

Trademarks

Lenovo and the Lenovo logo are trademarks or registered trademarks of Lenovo in the United States, other countries, or both. A current list of Lenovo trademarks is available on the Web at https://www.lenovo.com/us/en/legal/copytrade/.

The following terms are trademarks of Lenovo in the United States, other countries, or both:
Lenovo®
ThinkSystem®

The following terms are trademarks of other companies:

Linux® is the trademark of Linus Torvalds in the U.S. and other countries.

Other company, product, or service names may be trademarks or service marks of others.