Linux: how do i know the module that exports a device node?

后端 未结 2 1683
说谎
说谎 2021-01-30 11:48

If a have a /dev device node and its major/minor numbers how do i know the kernel module name that exported this node?

2条回答
  •  误落风尘
    2021-01-30 12:17

    The answer to this question is most likely different based on a number of factors. For example, if you're running udev, devfs, pre-devfs, etc.

    If you're using Ubuntu (or another equally modern distro) the udevadm command might be what you want.

    % udevadm info -q path -n /dev/cdrom
    /devices/pci0000:00/0000:00:1f.1/host3/target3:0:0/3:0:0:0/block/sr0
    

    So, my /dev/cdrom is provided by the sr driver, which resides in the sr_mod kernel module. I don't know of a command that takes /dev/cdrom as an argument and prints sr_mod as output.

提交回复
热议问题