0

Using ioctl interface various info can be fetched. How do you get extra info like product name, class, vendor name, subsystem name etc?

There are couple of command line tools available such as: 1. lshw -C network 2. detecting nic and ports on systems loaded with linux

You can start a process and get the result but Is there any raw c/c++ method to get above mentioned information?

Cheers

Prashant

Community
  • 1
  • 1
Prashant
  • 1
  • 1

2 Answers2

0

All the information you seek is in /sys/bus/pci/devices/*/*:

class
device
driver
modalias
subsystem
subsystem_device
subsystem_vendor
vendor

You can see how lspci(8) reads through the files with strace -o /tmp/out lspci, /tmp/out will have plenty of details. (I don't know any easy way to restrict this to just the NICs; I think both lspci(8) and the kernel have hard-coded lists of PCI ID -> name mappings.)

sarnold
  • 102,305
  • 22
  • 181
  • 238
0

Look in sysfs or procfs, unfortunately this information has a habit of being changed and so cannot be relied on :(

Angelom
  • 2,413
  • 1
  • 15
  • 8