Reading PCI IDs ? [Archive] - C Board

PDA

View Full Version : Reading PCI IDs ?


pgzh
03-24-2008, 09:04 AM
Hi,

how can one read the PCI ID of the chipset built into a computer?
I know lspci can do it with "-n" and the first line contains the PCI ID of the chipset:
$ lspci -n
00:00.0 0600: 8086:2a00 (rev 03)
[...]

The bold marked info is what I'm looking for. I haven't dealt with such things in C before and the lspci source code wasn't especially useful for me because I just wasn't able to understand it... (I'm not a professional coder, it's just a hobby and I'm not doing this for so long)

So if anyone can tell me where exactly in the lspci source code I will have to look or has a simpler piece of code it would be great if he'd share it with me :)

Peter

brewbuck
03-24-2008, 09:35 AM
Try looking at:

/proc/pci
/proc/bus/pci/devices
/proc/bus/pci/*

pheres
03-24-2008, 09:57 AM
lspci reads the files under /sys/bus/pci/devices (you can easily find this out without browsing it's source using the command #strace lspci 2>&1 | less)