3

I have remote access to a computer, and I need to find out what kind of expansion slots is has, if they are PCI, or PCI-E, or something else. How can I do this from a shell? What commands are there that would report the type and number of expansion slots?

Any help would be appreciated.

BenjiWiebe
  • 9,173

3 Answers3

7

dmidecode should display the information regarding the slots on your system.

The command needs to be run as root.

1

You could also try lspci -vvv, but I'm not sure if it will work with a remote machine.

matan129
  • 1,990
Tony
  • 21
  • 1
-1

I think I've figured out a native way to do this using only sysfs, though I can't guarantee it 100% given the nature of Linux...
(NOTE: this is for testing a particular device rather than a slot)

I'll be focusing on the PCI(e) device hierarchy, but such devices can also be accessed via /sys/bus/pci/drivers/* among other locations you intend to verify from.

From what I've discovered so far, all of my PCIe devices seem to have the link directory:
/sys/devices/pci0000:00/<devicepath>/link/
Where as all of my PCI devices so far have no trace of that directory.

Simply running a test <devicepath>/link/ seems to be enough to tell you if a device is PCIe or PCI.

$ test -d "/sys/devices/pci0000:00/0000:00:00.2/link" && echo true
true
if test -d "/sys/devices/pci0000:00/0000:00:00.2/link"; then
    # device is PCIe
else
    # device is PCI
fi
Tcll
  • 99