lspci源码

lspci

显示Linux系统的pci设备最简单的方法就是使用lspci命令,前提是要安装pciutils包(centos在最小化安装时不会自带该包,需要自己下载安装)

pciutils包的源码github地址为: https://github.com/pciutils/pciutils

从该项目的README文件可以知道,其主要提供三个命令:lspci、setpci和update-pciids。

  • lspci: displays detailed information about all PCI buses and devices.

  • setpci: allows to read from and write to PCI device configuration

registers. For example, you can adjust the latency timers with it.

CAUTION: There is a couple of dangerous points and caveats, please read

the manual page first!

  • update-pciids: download the current version of the pci.ids file.

update-pciids命令会从网上更新pci.ids文件,该文件包含着pci设备的vendor id和device id 与厂商名称、型号名称的对应关系,一旦更改该文件那么lspcishow出来的东西就会发生变化。

不同Linux发行版本的pci.ids文件的位置有所不同,比如centos一般在/usr/share/hwdata/pci.ids,而Debian一般在/usr/share/misc/pci.ids,lspci命令的路径一般在centos下的/usr/sbin/lspci,而在Debian下一般为/use/bin/lspci,update-pciids一般在/usr/sbin/update-pciids,这些路径如果是手动编译安装pciutils则可以自行定制,关于如何编译安装可参考pciutils-3.6.2。

同样,不同发行版本的pciutils也有差异,比如centos的update-pciids和Debian的 update-pciids是有区别的,最重要的区别在于其pci.ids更新的源不同

在Debian中:

#!/bin/sh

#URL="http://pci-ids.ucw.cz/pci.ids"

URL="http://pciids.sourceforge.net/v2.2/pci.ids"

FILE=/usr/share/misc/pci.ids

在centos中:

#!/bin/sh

"$1" = "-q" \] \&\& quiet=true \|\| quiet=false set -e SRC="http://pci-ids.ucw.cz/v2.2/pci.ids" DEST=/usr/share/hwdata/pci.ids

同样在qemu中也存在这么一个头文件,里面也是定义了各个pci设备vendor_id和device_id.

相关推荐
TG:@yunlaoda360 云老大7 分钟前
华为云国际站代理商NAT的规格有哪些?
服务器·网络·华为云
Guheyunyi24 分钟前
视频安全监测系统的三大核心突破
大数据·运维·服务器·人工智能·安全·音视频
石像鬼₧魂石26 分钟前
HexStrike AI 理想操作流程清单(完整功能版)
linux·人工智能·windows·学习·ubuntu
Xの哲學35 分钟前
Linux UPnP技术深度解析: 从设计哲学到实现细节
linux·服务器·网络·算法·边缘计算
柏木乃一39 分钟前
进程(6)进程切换,Linux中的进程组织,Linux进程调度算法
linux·服务器·c++·算法·架构·操作系统
Jelly-小丑鱼39 分钟前
Linux搭建SQLserver数据库和Orical数据库
linux·运维·数据库·sqlserver·oracal·docker容器数据库
CAU界编程小白41 分钟前
Linux编程系列之权限理解和基础开发工具的使用(下)
linux
Run_Teenage43 分钟前
Linux:进程等待
linux·运维·服务器
Trouvaille ~43 分钟前
【Linux】从磁盘到文件系统:深入理解Ext2文件系统
linux·运维·网络·c++·磁盘·文件系统·inode
wdfk_prog1 小时前
[Linux]学习笔记系列 -- [fs]file
linux·笔记·学习