如何知道是否有(编译在/内核模块中)设备驱动程序控制正在运行的Linux上的设备?
我如何知道正在运行的 Linux 是否支持某个设备,如果支持,哪个设备驱动程序控制它? 例如,服务器 (PowerEdge 2900) 上的 lspci
给出:
00:00.0 Host bridge: Intel Corporation 5000X Chipset Memory Controller Hub (rev 12)
00:02.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 2 (rev 12)
00:03.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 3 (rev 12)
00:04.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 4 (rev 12)
00:05.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 5 (rev 12)
00:06.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 6-7 (rev 12)
00:07.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 7 (rev 12)
00:08.0 System peripheral: Intel Corporation 5000 Series Chipset DMA Engine (rev 12)
00:10.0 Host bridge: Intel Corporation 5000 Series Chipset FSB Registers (rev 12)
00:10.1 Host bridge: Intel Corporation 5000 Series Chipset FSB Registers (rev 12)
00:10.2 Host bridge: Intel Corporation 5000 Series Chipset FSB Registers (rev 12)
00:11.0 Host bridge: Intel Corporation 5000 Series Chipset Reserved Registers (rev 12)
00:13.0 Host bridge: Intel Corporation 5000 Series Chipset Reserved Registers (rev 12)
00:15.0 Host bridge: Intel Corporation 5000 Series Chipset FBD Registers (rev 12)
00:16.0 Host bridge: Intel Corporation 5000 Series Chipset FBD Registers (rev 12)
00:1c.0 PCI bridge: Intel Corporation 631xESB/632xESB/3100 Chipset PCI Express Root Port 1 (rev 09)
00:1d.0 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #1 (rev 09)
00:1d.1 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #2 (rev 09)
00:1d.2 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #3 (rev 09)
00:1d.3 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #4 (rev 09)
00:1d.7 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset EHCI USB2 Controller (rev 09)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev d9)
00:1f.0 ISA bridge: Intel Corporation 631xESB/632xESB/3100 Chipset LPC Interface Controller (rev 09)
00:1f.1 IDE interface: Intel Corporation 631xESB/632xESB IDE Controller (rev 09)
00:1f.2 IDE interface: Intel Corporation 631xESB/632xESB/3100 Chipset SATA IDE Controller (rev 09)
01:00.0 PCI bridge: Intel Corporation 80333 Segment-A PCI Express-to-PCI Express Bridge
01:00.2 PCI bridge: Intel Corporation 80333 Segment-B PCI Express-to-PCI Express Bridge
02:0e.0 RAID bus controller: Dell PowerEdge Expandable RAID controller 5
04:00.0 PCI bridge: Broadcom EPB PCI-Express to PCI-X Bridge (rev c3)
05:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12)
06:00.0 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express Upstream Port (rev 01)
06:00.3 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express to PCI-X Bridge (rev 01)
07:00.0 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express Downstream Port E1 (rev 01)
07:01.0 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express Downstream Port E2 (rev 01)
08:00.0 PCI bridge: Broadcom EPB PCI-Express to PCI-X Bridge (rev c3)
09:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12)
0b:02.0 Multimedia audio controller: Creative Labs SB Audigy (rev 03)
0b:02.1 Input device controller: Creative Labs SB Audigy Game Port (rev 03)
0b:02.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port
10:0d.0 VGA compatible controller: ATI Technologies Inc ES1000 (rev 02)
如何找到:
- 哪个设备驱动程序(内核模块)控制每个设备?
- 哪个设备由在内核中编译的设备驱动程序(而不是作为模块)控制哪个设备
- 没有设备驱动程序(在内核中编译或作为模块编译)?
这个脚本(改编自“Linux Kernel in a Nutshell”中的另一个脚本)部分解决了#1:
#!/bin/bash
for i in $(find /sys/ -name modalias); do
echo "----------------------------------"
modalias=$(cat $i)
echo "$(dirname $i) --> $modalias"
/sbin/modprobe --config /dev/null --show-depends $(cat $i) 2>&1
done
但它存在一些问题:
我不知道自动转换方式 /sys/devices/pci0000:00/0000:00:1e.0/0000:10:0d.0 --> pci:v00001002d0000515Esv00001028sd000001B1bc03sc00i00 到
10:0d.0 VGA 兼容控制器:ATI Technologies Inc ES1000 (rev 02)
在某些情况下,设备位于 MB 内部,我什至不知道如何找到真正的设备设备的名称。 例如:
/sys/devices/platform/dcdbas --> platform:dcdbas
/sys/devices/platform/iTCO_wdt --> platform:iTCO_wdt
/sys/devices/LNXSYSTM:00 --> acpi:LNXSYSTM:
/sys/devices/LNXSYSTM:00/device:00/PNP0C33:00 --> acpi:PNP0C33:PNP0C01:
/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00 --> acpi:PNP0A08:PNP0A03:
/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/PNP0200:00 --> acpi:PNP0200:
等等。
- 当设备驱动程序已编译(或不存在)时,响应为“致命:未找到模块 _XXXX_”。 表示该设备没有模块。
在某些情况下,驱动程序是在(例如)中编译的。
/sys/devices/platform/serial8250 --> platform:serial8250
FATAL: Module platform:serial8250 not found.
/sys/devices/platform/i8042 --> platform:i8042
FATAL: Module platform:i8042 not found.
在其他情况下,驱动程序根本不存在。 但我不知道有什么方法可以区分。
有人知道吗?
How can I know if a device is supported on a running Linux and if so, which device driver controls it?
For instance, lspci
on a server (PowerEdge 2900) gives:
00:00.0 Host bridge: Intel Corporation 5000X Chipset Memory Controller Hub (rev 12)
00:02.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 2 (rev 12)
00:03.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 3 (rev 12)
00:04.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 4 (rev 12)
00:05.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 5 (rev 12)
00:06.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 6-7 (rev 12)
00:07.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 7 (rev 12)
00:08.0 System peripheral: Intel Corporation 5000 Series Chipset DMA Engine (rev 12)
00:10.0 Host bridge: Intel Corporation 5000 Series Chipset FSB Registers (rev 12)
00:10.1 Host bridge: Intel Corporation 5000 Series Chipset FSB Registers (rev 12)
00:10.2 Host bridge: Intel Corporation 5000 Series Chipset FSB Registers (rev 12)
00:11.0 Host bridge: Intel Corporation 5000 Series Chipset Reserved Registers (rev 12)
00:13.0 Host bridge: Intel Corporation 5000 Series Chipset Reserved Registers (rev 12)
00:15.0 Host bridge: Intel Corporation 5000 Series Chipset FBD Registers (rev 12)
00:16.0 Host bridge: Intel Corporation 5000 Series Chipset FBD Registers (rev 12)
00:1c.0 PCI bridge: Intel Corporation 631xESB/632xESB/3100 Chipset PCI Express Root Port 1 (rev 09)
00:1d.0 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #1 (rev 09)
00:1d.1 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #2 (rev 09)
00:1d.2 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #3 (rev 09)
00:1d.3 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #4 (rev 09)
00:1d.7 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset EHCI USB2 Controller (rev 09)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev d9)
00:1f.0 ISA bridge: Intel Corporation 631xESB/632xESB/3100 Chipset LPC Interface Controller (rev 09)
00:1f.1 IDE interface: Intel Corporation 631xESB/632xESB IDE Controller (rev 09)
00:1f.2 IDE interface: Intel Corporation 631xESB/632xESB/3100 Chipset SATA IDE Controller (rev 09)
01:00.0 PCI bridge: Intel Corporation 80333 Segment-A PCI Express-to-PCI Express Bridge
01:00.2 PCI bridge: Intel Corporation 80333 Segment-B PCI Express-to-PCI Express Bridge
02:0e.0 RAID bus controller: Dell PowerEdge Expandable RAID controller 5
04:00.0 PCI bridge: Broadcom EPB PCI-Express to PCI-X Bridge (rev c3)
05:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12)
06:00.0 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express Upstream Port (rev 01)
06:00.3 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express to PCI-X Bridge (rev 01)
07:00.0 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express Downstream Port E1 (rev 01)
07:01.0 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express Downstream Port E2 (rev 01)
08:00.0 PCI bridge: Broadcom EPB PCI-Express to PCI-X Bridge (rev c3)
09:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12)
0b:02.0 Multimedia audio controller: Creative Labs SB Audigy (rev 03)
0b:02.1 Input device controller: Creative Labs SB Audigy Game Port (rev 03)
0b:02.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port
10:0d.0 VGA compatible controller: ATI Technologies Inc ES1000 (rev 02)
How can I find:
- which device driver (kernel module) controls each device?
- which device is controlled by a device driver compiled in the kernel (and not as a module)
- which device doesn't have a device driver (compiled in or as a module)?
This script (adapted from another in "Linux Kernel in a Nutshell") partially resolves #1:
#!/bin/bash
for i in $(find /sys/ -name modalias); do
echo "----------------------------------"
modalias=$(cat $i)
echo "$(dirname $i) --> $modalias"
/sbin/modprobe --config /dev/null --show-depends $(cat $i) 2>&1
done
But there are some problems with it:
I don't know of an automated way to convert
/sys/devices/pci0000:00/0000:00:1e.0/0000:10:0d.0 --> pci:v00001002d0000515Esv00001028sd000001B1bc03sc00i00
to10:0d.0 VGA compatible controller: ATI Technologies Inc ES1000 (rev 02)
In some cases the devices are internal to the MB and I don't even know a way to find the real name of the device. For example:
/sys/devices/platform/dcdbas --> platform:dcdbas
/sys/devices/platform/iTCO_wdt --> platform:iTCO_wdt
/sys/devices/LNXSYSTM:00 --> acpi:LNXSYSTM:
/sys/devices/LNXSYSTM:00/device:00/PNP0C33:00 --> acpi:PNP0C33:PNP0C01:
/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00 --> acpi:PNP0A08:PNP0A03:
/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/PNP0200:00 --> acpi:PNP0200:
and many others.
- When the device driver is compiled in (or doesn't exist) the response is
FATAL: Module _XXXX_ not found.
Indicating there is no module for the device.
In some cases the driver is compiled in (e.g.)
/sys/devices/platform/serial8250 --> platform:serial8250
FATAL: Module platform:serial8250 not found.
/sys/devices/platform/i8042 --> platform:i8042
FATAL: Module platform:i8042 not found.
In other cases, the driver just doesn't exist. But I don't know a way to tell the difference.
Does anyone know?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
尝试HAL设备管理器,它也可以作为“KDE HAL设备管理器”和“gnome-device-manager”使用。 基本上,这些是硬件抽象层 (HAL) 的前端,它读取
/sysfs/
等。它提供了类似“info.linux.driver”的信息,请参见下面的屏幕截图:
抱歉我不知道如何自己在 sysfs 中找出这些信息,但如果 HAL 能够找到它,它一定在某个地方:-)
Try HAL device manager, which is also available as "KDE HAL device manager" and "gnome-device-manager". Basically, these are frontends to the Hardware Abstraction Layer (HAL), which reads
/sysfs/
et al.It gives information like "info.linux.driver", see the screenshot below:
I'm sorry I don't know how to fiddle out this information yourself in sysfs, but it must be somewhere if HAL is able to find it :-)
好吧,这有点晚了,也许当时(2008 年)甚至不存在,但 lspci -n 或更好的 lspci -k 应该可以解决问题; 例如:
Well this is a little late, and maybe at that time (2008) didn't even exists, but lspci -n or better lspci -k should fix the problem; for instance:
lspci -n 将为您提供 PCI ID,您可以在 Linux 内核驱动程序数据库 上搜索该 ID。 这将告诉您要启用哪些内核选项。
lspci -n will give you PCI ids that you can search for on the linux kernel driver database. This will tell you which kernel options to enable.
下面的脚本将告诉您哪些动态加载的驱动程序正在运行,尽管我也希望有一种自动方式来确定哪些模块中编译的驱动程序实际上也在使用,这样我就可以进一步消除内核的膨胀。
我不确定其余部分与您的问题有多大相关性,但我认为您或其他人可能会发现它有用。
下面的代码将找出哪些 .config 选项控制每个动态加载的内核模块,尽管我还没有找到一种方法来对 ubuntu lum 包中的动态模块执行相同的操作(此脚本仍在进行中) ):
Andreas Goelzer 有一个脚本,稍作修改即可关闭 .config 中所有未使用的内核模块,从而显着加快编译速度。
您可以在这里找到它:
http://andreas.goelzer.de/基于 lsmod 输出的内核配置
The following script will tell you which dynamically loaded drivers are running, although I would also like an automated way of figuring out which compiled in modules are actually in use also so I could de-bloat my kernel some more.
I'm not sure how relevent the rest of this is to your question but thought you or others might find it useful.
The following code will figure out which .config options control each of the dynamically loaded kernel modules, although I haven't figured out a way to do the same for dynamic modules in the ubuntu lum package yet ( this script is still a work in progress ):
There is a script by Andreas Goelzer which with slight modification will turn off all unused kernel modules in your .config which significantly speeds up your compiles.
You can find it here:
http://andreas.goelzer.de/kernel-config-based-on-lsmod-output
我认为您无法在 Windows 设备管理器中获得 100% 明确的答案。
nvidia
+agpgart
)。usbhid
)。usbcore
+usbhid
)。I don't think you can get a 100% clear-cut answer that you can get in Windows device manager.
nvidia
+agpgart
).usbhid
).usbcore
+usbhid
).