A patch queued into the PCI subsystem’s “next” branch ahead of the Linux 6.18 merge window will uniformally expose the PCI device serial number of devices via sysfs for easy programmatic parsing.
This is similar to the PCI device serial number reporting available with lspci but now can be done via sysfs for those wanting to enumerate PCI device serial numbers that way.
For those concerned about rogue software reading your PCI/PCIe device serial numbers, the serial_number sysfs reporting is limited to admin/root privileges. The patch adding the “serial_number” node to PCI devices with sysfs explains:
“Add a single sysfs read-only interface for reading PCI device serial numbers from userspace in a programmatic way. This device attribute uses the same hexadecimal 1-byte dashed formatting as lspci serial number capability output. If a device doesn’t support the serial number capability, the serial_number sysfs attribute will not be visible.”
With the patch now in the PCI subsystem’s “next” Git branch, it should be submitted for the upcoming Linux 6.18 merge window. As it’s a straight-forward addition, this “serial_number” sysfs addition will likely be merged without any real opposition.