您可以通过浏览sysfs来访问许多信息。 也可以写入sysfs中的某些文件以执行某些命令,例如PCI总线重新枚举;)
例如,列出所有PCI设备可以通过以下方式完成:paebbels@debian8:/sys/bus/pci/devices$ ll /sys/bus/pci/devices
insgesamt 0
drwxr-xr-x 2 root root 0 Dez 12 00:33 .
drwxr-xr-x 5 root root 0 Dez 12 00:33 ..
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:00:00.0 -> ../../../devices/pci0000:00/0000:00:00.0
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:00:01.0 -> ../../../devices/pci0000:00/0000:00:01.0
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:00:07.0 -> ../../../devices/pci0000:00/0000:00:07.0
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:00:07.1 -> ../../../devices/pci0000:00/0000:00:07.1
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:00:07.3 -> ../../../devices/pci0000:00/0000:00:07.3
...
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:00:18.2 -> ../../../devices/pci0000:00/0000:00:18.2
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:00:18.3 -> ../../../devices/pci0000:00/0000:00:18.3
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:00:18.4 -> ../../../devices/pci0000:00/0000:00:18.4
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:00:18.5 -> ../../../devices/pci0000:00/0000:00:18.5
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:00:18.6 -> ../../../devices/pci0000:00/0000:00:18.6
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:00:18.7 -> ../../../devices/pci0000:00/0000:00:18.7
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:02:00.0 -> ../../../devices/pci0000:00/0000:00:11.0/0000:02:00.0
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:02:01.0 -> ../../../devices/pci0000:00/0000:00:11.0/0000:02:01.0
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:02:02.0 -> ../../../devices/pci0000:00/0000:00:11.0/0000:02:02.0
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:02:03.0 -> ../../../devices/pci0000:00/0000:00:11.0/0000:02:03.0
lrwxrwxrwx 1 root root 0 Dez 12 00:33 0000:03:00.0 -> ../../../devices/pci0000:00/0000:00:15.0/0000:03:00.0
注意:这是VMWare中的Debian->扁平PCI层次结构。
这是设备0000:02:00.0的示例:paebbels@debian8:/sys/bus/pci/devices/0000:02:00.0$ ls -ahlL /sys/bus/pci/devices/0000\:02\:00.0
insgesamt 0
drwxr-xr-x 4 root root 0 Dez 12 00:37 .
drwxr-xr-x 8 root root 0 Dez 12 00:37 ..
-r--r--r-- 1 root root 4,0K Dez 12 00:37 acpi_index
-rw-r--r-- 1 root root 4,0K Dez 12 00:37 broken_parity_status
-r--r--r-- 1 root root 4,0K Dez 12 00:37 class
-rw-r--r-- 1 root root 256 Dez 12 00:37 config
-r--r--r-- 1 root root 4,0K Dez 12 00:37 consistent_dma_mask_bits
-rw-r--r-- 1 root root 4,0K Dez 12 00:37 d3cold_allowed
-r--r--r-- 1 root root 4,0K Dez 12 00:37 device
-r--r--r-- 1 root root 4,0K Dez 12 00:37 dma_mask_bits
drwxr-xr-x 2 root root 0 Dez 8 11:18 driver -> ../../../../bus/pci/drivers/uhci_hcd
-rw-r--r-- 1 root root 4,0K Dez 12 00:37 driver_override
-rw-r--r-- 1 root root 4,0K Dez 12 00:37 enabled
drwxr-xr-x 3 root root 0 Dez 12 00:37 firmware_node -> ../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:05/device:06
-r--r--r-- 1 root root 4,0K Dez 12 00:37 irq
-r--r--r-- 1 root root 4,0K Dez 12 00:37 label
-r--r--r-- 1 root root 4,0K Dez 12 00:37 local_cpulist
-r--r--r-- 1 root root 4,0K Dez 12 00:37 local_cpus
-r--r--r-- 1 root root 4,0K Dez 12 00:37 modalias
-rw-r--r-- 1 root root 4,0K Dez 12 00:37 msi_bus
-r--r--r-- 1 root root 4,0K Dez 12 00:37 numa_node
-r--r--r-- 1 root root 4,0K Dez 12 00:37 pools
drwxr-xr-x 2 root root 0 Dez 12 00:37 power
--w--w---- 1 root root 4,0K Dez 12 00:37 remove
--w--w---- 1 root root 4,0K Dez 12 00:37 rescan
--w------- 1 root root 4,0K Dez 12 00:37 reset
-r--r--r-- 1 root root 4,0K Dez 12 00:37 resource
-rw------- 1 root root 32 Dez 12 00:37 resource4
drwxr-xr-x 5 root root 0 Dez 12 00:33 subsystem -> ../../../../bus/pci
-r--r--r-- 1 root root 4,0K Dez 12 00:37 subsystem_device
-r--r--r-- 1 root root 4,0K Dez 12 00:37 subsystem_vendor
-rw-r--r-- 1 root root 4,0K Dez 12 00:37 uevent
drwxr-xr-x 5 root root 0 Dez 12 00:37 usb4
-r--r--r-- 1 root root 4,0K Dez 12 00:37 vendor
您可以看到设备0000:02:00.0使用了驱动程序'uhci_hcd'。
尼斯浏览:)