linuxlinux-kernelpci-epci-bus

pci device info access in linux from userspace


I want to access the pci device tree information from user space programatically. Like the root complex and the devices connected to it. How can I do it please let me know.

Regards, Pradeep


Solution

  • libpci or pcilib (on which lspci is based) uses sysfs, procfs, and possibly other means to access PCI information. You can check pciutils package source code for further reference:

    https://github.com/gittup/pciutils

    https://github.com/gittup/pciutils/blob/gittup/lspci.c