How to find kernel module for a given device?












3















I am trying to troubleshoot a problem: usb mouse doesn't work on a freshly installed linux.



I suspect the problem is that there is no suitable kernel module/driver for my usb hardware. Indeed:



$ lspci -knn
...
01:00.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Device [1022:43b9] (rev 02)
Subsystem: ASMedia Technology Inc. Device [1b21:1142]
01:00.1 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] Device [1022:43b5] (rev 02)
Subsystem: ASMedia Technology Inc. Device [1b21:1062]
Kernel driver in use: ahci
...


As you can see no kernel driver is reported for USB controller device (I suppose it should be reported in a way similar to driver reported for SATA controller)



So, I need to rebuild kernel with a module which would be suitable for my device. But how can I find out what module should I build? I have information which identifies my device: it's vendor id and hardware id ([1b21:43b9]). How to find out corresponding kernel module name given this information?










share|improve this question




















  • 1





    @GAD3R lsusb reports nothing. As I understand it is a more high-level command, it can't report anything because there is no kernel driver for USB controller. Is this understanding correct?

    – lesnik
    Dec 23 '18 at 18:04






  • 1





    If the kernel module is not built (or not loaded), or if maybe no kernel module for this device even exists, there's no direct way to find out. Which leaves google (in particular if you need a newer kernel than you have) and greping through the kernel sources, both of which I've done with success in the past.

    – dirkt
    Dec 23 '18 at 19:02
















3















I am trying to troubleshoot a problem: usb mouse doesn't work on a freshly installed linux.



I suspect the problem is that there is no suitable kernel module/driver for my usb hardware. Indeed:



$ lspci -knn
...
01:00.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Device [1022:43b9] (rev 02)
Subsystem: ASMedia Technology Inc. Device [1b21:1142]
01:00.1 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] Device [1022:43b5] (rev 02)
Subsystem: ASMedia Technology Inc. Device [1b21:1062]
Kernel driver in use: ahci
...


As you can see no kernel driver is reported for USB controller device (I suppose it should be reported in a way similar to driver reported for SATA controller)



So, I need to rebuild kernel with a module which would be suitable for my device. But how can I find out what module should I build? I have information which identifies my device: it's vendor id and hardware id ([1b21:43b9]). How to find out corresponding kernel module name given this information?










share|improve this question




















  • 1





    @GAD3R lsusb reports nothing. As I understand it is a more high-level command, it can't report anything because there is no kernel driver for USB controller. Is this understanding correct?

    – lesnik
    Dec 23 '18 at 18:04






  • 1





    If the kernel module is not built (or not loaded), or if maybe no kernel module for this device even exists, there's no direct way to find out. Which leaves google (in particular if you need a newer kernel than you have) and greping through the kernel sources, both of which I've done with success in the past.

    – dirkt
    Dec 23 '18 at 19:02














3












3








3


1






I am trying to troubleshoot a problem: usb mouse doesn't work on a freshly installed linux.



I suspect the problem is that there is no suitable kernel module/driver for my usb hardware. Indeed:



$ lspci -knn
...
01:00.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Device [1022:43b9] (rev 02)
Subsystem: ASMedia Technology Inc. Device [1b21:1142]
01:00.1 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] Device [1022:43b5] (rev 02)
Subsystem: ASMedia Technology Inc. Device [1b21:1062]
Kernel driver in use: ahci
...


As you can see no kernel driver is reported for USB controller device (I suppose it should be reported in a way similar to driver reported for SATA controller)



So, I need to rebuild kernel with a module which would be suitable for my device. But how can I find out what module should I build? I have information which identifies my device: it's vendor id and hardware id ([1b21:43b9]). How to find out corresponding kernel module name given this information?










share|improve this question
















I am trying to troubleshoot a problem: usb mouse doesn't work on a freshly installed linux.



I suspect the problem is that there is no suitable kernel module/driver for my usb hardware. Indeed:



$ lspci -knn
...
01:00.0 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Device [1022:43b9] (rev 02)
Subsystem: ASMedia Technology Inc. Device [1b21:1142]
01:00.1 SATA controller [0106]: Advanced Micro Devices, Inc. [AMD] Device [1022:43b5] (rev 02)
Subsystem: ASMedia Technology Inc. Device [1b21:1062]
Kernel driver in use: ahci
...


As you can see no kernel driver is reported for USB controller device (I suppose it should be reported in a way similar to driver reported for SATA controller)



So, I need to rebuild kernel with a module which would be suitable for my device. But how can I find out what module should I build? I have information which identifies my device: it's vendor id and hardware id ([1b21:43b9]). How to find out corresponding kernel module name given this information?







usb kernel-modules






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 23 '18 at 18:47







lesnik

















asked Dec 23 '18 at 16:36









lesniklesnik

3912312




3912312








  • 1





    @GAD3R lsusb reports nothing. As I understand it is a more high-level command, it can't report anything because there is no kernel driver for USB controller. Is this understanding correct?

    – lesnik
    Dec 23 '18 at 18:04






  • 1





    If the kernel module is not built (or not loaded), or if maybe no kernel module for this device even exists, there's no direct way to find out. Which leaves google (in particular if you need a newer kernel than you have) and greping through the kernel sources, both of which I've done with success in the past.

    – dirkt
    Dec 23 '18 at 19:02














  • 1





    @GAD3R lsusb reports nothing. As I understand it is a more high-level command, it can't report anything because there is no kernel driver for USB controller. Is this understanding correct?

    – lesnik
    Dec 23 '18 at 18:04






  • 1





    If the kernel module is not built (or not loaded), or if maybe no kernel module for this device even exists, there's no direct way to find out. Which leaves google (in particular if you need a newer kernel than you have) and greping through the kernel sources, both of which I've done with success in the past.

    – dirkt
    Dec 23 '18 at 19:02








1




1





@GAD3R lsusb reports nothing. As I understand it is a more high-level command, it can't report anything because there is no kernel driver for USB controller. Is this understanding correct?

– lesnik
Dec 23 '18 at 18:04





@GAD3R lsusb reports nothing. As I understand it is a more high-level command, it can't report anything because there is no kernel driver for USB controller. Is this understanding correct?

– lesnik
Dec 23 '18 at 18:04




1




1





If the kernel module is not built (or not loaded), or if maybe no kernel module for this device even exists, there's no direct way to find out. Which leaves google (in particular if you need a newer kernel than you have) and greping through the kernel sources, both of which I've done with success in the past.

– dirkt
Dec 23 '18 at 19:02





If the kernel module is not built (or not loaded), or if maybe no kernel module for this device even exists, there's no direct way to find out. Which leaves google (in particular if you need a newer kernel than you have) and greping through the kernel sources, both of which I've done with success in the past.

– dirkt
Dec 23 '18 at 19:02










2 Answers
2






active

oldest

votes


















7














PCI ID 1022:43b9 is an AMD X370 Series Chipset USB 3.1 xHCI Controller. The PCI subsystem ID 1b21:1142 would suggest it might actually be an ASMedia ASM1042A USB 3 controller, possibly integrated into the AMD chipset.



For most USB 3.x controller chips, the appropriate driver module is xhci_pci which depends on module xhci_hcd. Both these modules are part of the standard Linux kernel, so they should be available in all modern Linux distributions. The corresponding kernel configuration options are CONFIG_USB_XHCI_PCI and CONFIG_USB_XHCI_HCD.



Many distributions include the kernel configuration file as /boot/config-<kernel version number>. So, you could run this command:



$ grep XHCI /boot/config-$(uname -r)
CONFIG_USB_XHCI_HCD=m
CONFIG_USB_XHCI_PCI=m
# CONFIG_USB_XHCI_PLATFORM is not set


Here, both xhci_hcd and xhci_pci are configured to be available as modules. If the lines would say ...=y instead, the USB 3 support would be compiled into the main kernel.



PCI ID 1022:43b5, subsystem ID 1b21:1062 is an AHCI SATA (or eSATA) controller, which is already covered by module ahci.



You can look up PCI IDs in PCI ID Repository.



If a driver has been specified by vendor/product IDs, you could use /sbin/modprobe -c | grep '<vendor ID>.*<product ID>'. If you get back a line like this, you've found a match:



alias pci:v0000<vendor ID>:d0000<product ID>sv... <module name>


This information comes from /lib/modules/modules.alias[.bin], which is generated by the depmod command from the device support information embedded in the kernel modules themselves (defined in the source code with a MODULE_DEVICE_TABLE macro). You can also use modinfo <module name> | grep alias to view the hardware support claimed by a particular module.



However, not all modules are specified by vendor/product IDs. Some drivers will cover an entire class of devices; for example, the xhci_pci module claims support of PCI base class 0x0C, subclass 0x03, interface 0x30... which maps to "Serial bus controller", "USB controller" and "XHCI" respectively. This is expressed as



alias:          pci:v*d*sv*sd*bc0Csc03i30*


Note that you should not normally need to do any of these lookups manually unless you've blacklisted some modules or the auto-detection fails for some reason. For example, when the Linux kernel detects the original poster's USB 3 controller, it will cause (the equivalent of) the following command to be executed:



modprobe pci:v00001022d000043b9sv1b21sd1142bc0Csc03i30


which contains all the hardware vendor/device/class/subclass/interface IDs available for the device. If one of the wildcarded aliases on record in modprobe configuration matches this string, the respective module will get loaded automatically.



For USB devices (and indeed for any autoprobeable buses), there is a similar system of module aliases, and a USB ID repository.



If you don't have the appropriate module compiled on your system, your best bet is to use the PCI ID repository to identify the device or the chip used within it. Sometimes the repository entry identifies the Linux kernel module that will provide support for it. If that information is not present, you may need to google using the device/chip model; this will usually allow you to find any alternative/experimental driver modules that have not (yet?) been included in the standard kernel.






share|improve this answer





















  • 2





    Thanks, you are correct. xhci_hcd module was required. I just found it using live usb with another version of linux. lspci -k command showed me the module name. But this doesn't feel like a true way to resolve similar problems. The question still remains - what is a consistent way to find out kernel module given the hardware id's?

    – lesnik
    Dec 23 '18 at 18:53



















2














If the module isn't built into the kernel (on RedHat 7 and variants, XHCI_HCD is not loaded as a module, but part of the base image) you can look at the modules.aliases file for your kernel.



e.g.



% grep 1B21 /lib/modules/$(uname -r)/modules.alias
alias pci:v00001B21d00000612sv*sd*bc*sc*i* ahci
alias pci:v00001B21d00000611sv*sd*bc*sc*i* ahci
alias pci:v00001B21d00000602sv*sd*bc*sc*i* ahci
alias pci:v00001B21d00000601sv*sd*bc*sc*i* ahci


We can see the "v"endor ID, and "d"evice ID values in this file, and the corresponding module ("ahci") that should be loaded.



We can verify this module handles those drivers:



% modinfo /usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/drivers/ata/ahci.ko.xz
filename: /usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/drivers/ata/ahci.ko.xz
version: 3.0
license: GPL
description: AHCI SATA low-level driver
author: Jeff Garzik
retpoline: Y
rhelversion: 7.6
srcversion: 4BCC52C20C316AF69F3584A
....
alias: pci:v00001B21d00000612sv*sd*bc*sc*i*
alias: pci:v00001B21d00000611sv*sd*bc*sc*i*
alias: pci:v00001B21d00000602sv*sd*bc*sc*i*
alias: pci:v00001B21d00000601sv*sd*bc*sc*i*
...
depends: libahci,libata
intree: Y
vermagic: 3.10.0-957.1.3.el7.x86_64 SMP mod_unload modversions
signer: CentOS Linux kernel signing key
sig_key: E7:CE:F3:61:3A:9B:8B:D0:12:FA:E7:49:82:72:15:9B:B1:87:9C:65
sig_hashalgo: sha256
parm: marvell_enable:Marvell SATA via AHCI (1 = enabled) (int)


The values in the modules.alias file correspond to:



 v     (vendor)
d (device)
sv (subvendor)
sd (subdevice)
bc (bus class)
sc (bus subclass)
i (interface)





share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490625%2fhow-to-find-kernel-module-for-a-given-device%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    7














    PCI ID 1022:43b9 is an AMD X370 Series Chipset USB 3.1 xHCI Controller. The PCI subsystem ID 1b21:1142 would suggest it might actually be an ASMedia ASM1042A USB 3 controller, possibly integrated into the AMD chipset.



    For most USB 3.x controller chips, the appropriate driver module is xhci_pci which depends on module xhci_hcd. Both these modules are part of the standard Linux kernel, so they should be available in all modern Linux distributions. The corresponding kernel configuration options are CONFIG_USB_XHCI_PCI and CONFIG_USB_XHCI_HCD.



    Many distributions include the kernel configuration file as /boot/config-<kernel version number>. So, you could run this command:



    $ grep XHCI /boot/config-$(uname -r)
    CONFIG_USB_XHCI_HCD=m
    CONFIG_USB_XHCI_PCI=m
    # CONFIG_USB_XHCI_PLATFORM is not set


    Here, both xhci_hcd and xhci_pci are configured to be available as modules. If the lines would say ...=y instead, the USB 3 support would be compiled into the main kernel.



    PCI ID 1022:43b5, subsystem ID 1b21:1062 is an AHCI SATA (or eSATA) controller, which is already covered by module ahci.



    You can look up PCI IDs in PCI ID Repository.



    If a driver has been specified by vendor/product IDs, you could use /sbin/modprobe -c | grep '<vendor ID>.*<product ID>'. If you get back a line like this, you've found a match:



    alias pci:v0000<vendor ID>:d0000<product ID>sv... <module name>


    This information comes from /lib/modules/modules.alias[.bin], which is generated by the depmod command from the device support information embedded in the kernel modules themselves (defined in the source code with a MODULE_DEVICE_TABLE macro). You can also use modinfo <module name> | grep alias to view the hardware support claimed by a particular module.



    However, not all modules are specified by vendor/product IDs. Some drivers will cover an entire class of devices; for example, the xhci_pci module claims support of PCI base class 0x0C, subclass 0x03, interface 0x30... which maps to "Serial bus controller", "USB controller" and "XHCI" respectively. This is expressed as



    alias:          pci:v*d*sv*sd*bc0Csc03i30*


    Note that you should not normally need to do any of these lookups manually unless you've blacklisted some modules or the auto-detection fails for some reason. For example, when the Linux kernel detects the original poster's USB 3 controller, it will cause (the equivalent of) the following command to be executed:



    modprobe pci:v00001022d000043b9sv1b21sd1142bc0Csc03i30


    which contains all the hardware vendor/device/class/subclass/interface IDs available for the device. If one of the wildcarded aliases on record in modprobe configuration matches this string, the respective module will get loaded automatically.



    For USB devices (and indeed for any autoprobeable buses), there is a similar system of module aliases, and a USB ID repository.



    If you don't have the appropriate module compiled on your system, your best bet is to use the PCI ID repository to identify the device or the chip used within it. Sometimes the repository entry identifies the Linux kernel module that will provide support for it. If that information is not present, you may need to google using the device/chip model; this will usually allow you to find any alternative/experimental driver modules that have not (yet?) been included in the standard kernel.






    share|improve this answer





















    • 2





      Thanks, you are correct. xhci_hcd module was required. I just found it using live usb with another version of linux. lspci -k command showed me the module name. But this doesn't feel like a true way to resolve similar problems. The question still remains - what is a consistent way to find out kernel module given the hardware id's?

      – lesnik
      Dec 23 '18 at 18:53
















    7














    PCI ID 1022:43b9 is an AMD X370 Series Chipset USB 3.1 xHCI Controller. The PCI subsystem ID 1b21:1142 would suggest it might actually be an ASMedia ASM1042A USB 3 controller, possibly integrated into the AMD chipset.



    For most USB 3.x controller chips, the appropriate driver module is xhci_pci which depends on module xhci_hcd. Both these modules are part of the standard Linux kernel, so they should be available in all modern Linux distributions. The corresponding kernel configuration options are CONFIG_USB_XHCI_PCI and CONFIG_USB_XHCI_HCD.



    Many distributions include the kernel configuration file as /boot/config-<kernel version number>. So, you could run this command:



    $ grep XHCI /boot/config-$(uname -r)
    CONFIG_USB_XHCI_HCD=m
    CONFIG_USB_XHCI_PCI=m
    # CONFIG_USB_XHCI_PLATFORM is not set


    Here, both xhci_hcd and xhci_pci are configured to be available as modules. If the lines would say ...=y instead, the USB 3 support would be compiled into the main kernel.



    PCI ID 1022:43b5, subsystem ID 1b21:1062 is an AHCI SATA (or eSATA) controller, which is already covered by module ahci.



    You can look up PCI IDs in PCI ID Repository.



    If a driver has been specified by vendor/product IDs, you could use /sbin/modprobe -c | grep '<vendor ID>.*<product ID>'. If you get back a line like this, you've found a match:



    alias pci:v0000<vendor ID>:d0000<product ID>sv... <module name>


    This information comes from /lib/modules/modules.alias[.bin], which is generated by the depmod command from the device support information embedded in the kernel modules themselves (defined in the source code with a MODULE_DEVICE_TABLE macro). You can also use modinfo <module name> | grep alias to view the hardware support claimed by a particular module.



    However, not all modules are specified by vendor/product IDs. Some drivers will cover an entire class of devices; for example, the xhci_pci module claims support of PCI base class 0x0C, subclass 0x03, interface 0x30... which maps to "Serial bus controller", "USB controller" and "XHCI" respectively. This is expressed as



    alias:          pci:v*d*sv*sd*bc0Csc03i30*


    Note that you should not normally need to do any of these lookups manually unless you've blacklisted some modules or the auto-detection fails for some reason. For example, when the Linux kernel detects the original poster's USB 3 controller, it will cause (the equivalent of) the following command to be executed:



    modprobe pci:v00001022d000043b9sv1b21sd1142bc0Csc03i30


    which contains all the hardware vendor/device/class/subclass/interface IDs available for the device. If one of the wildcarded aliases on record in modprobe configuration matches this string, the respective module will get loaded automatically.



    For USB devices (and indeed for any autoprobeable buses), there is a similar system of module aliases, and a USB ID repository.



    If you don't have the appropriate module compiled on your system, your best bet is to use the PCI ID repository to identify the device or the chip used within it. Sometimes the repository entry identifies the Linux kernel module that will provide support for it. If that information is not present, you may need to google using the device/chip model; this will usually allow you to find any alternative/experimental driver modules that have not (yet?) been included in the standard kernel.






    share|improve this answer





















    • 2





      Thanks, you are correct. xhci_hcd module was required. I just found it using live usb with another version of linux. lspci -k command showed me the module name. But this doesn't feel like a true way to resolve similar problems. The question still remains - what is a consistent way to find out kernel module given the hardware id's?

      – lesnik
      Dec 23 '18 at 18:53














    7












    7








    7







    PCI ID 1022:43b9 is an AMD X370 Series Chipset USB 3.1 xHCI Controller. The PCI subsystem ID 1b21:1142 would suggest it might actually be an ASMedia ASM1042A USB 3 controller, possibly integrated into the AMD chipset.



    For most USB 3.x controller chips, the appropriate driver module is xhci_pci which depends on module xhci_hcd. Both these modules are part of the standard Linux kernel, so they should be available in all modern Linux distributions. The corresponding kernel configuration options are CONFIG_USB_XHCI_PCI and CONFIG_USB_XHCI_HCD.



    Many distributions include the kernel configuration file as /boot/config-<kernel version number>. So, you could run this command:



    $ grep XHCI /boot/config-$(uname -r)
    CONFIG_USB_XHCI_HCD=m
    CONFIG_USB_XHCI_PCI=m
    # CONFIG_USB_XHCI_PLATFORM is not set


    Here, both xhci_hcd and xhci_pci are configured to be available as modules. If the lines would say ...=y instead, the USB 3 support would be compiled into the main kernel.



    PCI ID 1022:43b5, subsystem ID 1b21:1062 is an AHCI SATA (or eSATA) controller, which is already covered by module ahci.



    You can look up PCI IDs in PCI ID Repository.



    If a driver has been specified by vendor/product IDs, you could use /sbin/modprobe -c | grep '<vendor ID>.*<product ID>'. If you get back a line like this, you've found a match:



    alias pci:v0000<vendor ID>:d0000<product ID>sv... <module name>


    This information comes from /lib/modules/modules.alias[.bin], which is generated by the depmod command from the device support information embedded in the kernel modules themselves (defined in the source code with a MODULE_DEVICE_TABLE macro). You can also use modinfo <module name> | grep alias to view the hardware support claimed by a particular module.



    However, not all modules are specified by vendor/product IDs. Some drivers will cover an entire class of devices; for example, the xhci_pci module claims support of PCI base class 0x0C, subclass 0x03, interface 0x30... which maps to "Serial bus controller", "USB controller" and "XHCI" respectively. This is expressed as



    alias:          pci:v*d*sv*sd*bc0Csc03i30*


    Note that you should not normally need to do any of these lookups manually unless you've blacklisted some modules or the auto-detection fails for some reason. For example, when the Linux kernel detects the original poster's USB 3 controller, it will cause (the equivalent of) the following command to be executed:



    modprobe pci:v00001022d000043b9sv1b21sd1142bc0Csc03i30


    which contains all the hardware vendor/device/class/subclass/interface IDs available for the device. If one of the wildcarded aliases on record in modprobe configuration matches this string, the respective module will get loaded automatically.



    For USB devices (and indeed for any autoprobeable buses), there is a similar system of module aliases, and a USB ID repository.



    If you don't have the appropriate module compiled on your system, your best bet is to use the PCI ID repository to identify the device or the chip used within it. Sometimes the repository entry identifies the Linux kernel module that will provide support for it. If that information is not present, you may need to google using the device/chip model; this will usually allow you to find any alternative/experimental driver modules that have not (yet?) been included in the standard kernel.






    share|improve this answer















    PCI ID 1022:43b9 is an AMD X370 Series Chipset USB 3.1 xHCI Controller. The PCI subsystem ID 1b21:1142 would suggest it might actually be an ASMedia ASM1042A USB 3 controller, possibly integrated into the AMD chipset.



    For most USB 3.x controller chips, the appropriate driver module is xhci_pci which depends on module xhci_hcd. Both these modules are part of the standard Linux kernel, so they should be available in all modern Linux distributions. The corresponding kernel configuration options are CONFIG_USB_XHCI_PCI and CONFIG_USB_XHCI_HCD.



    Many distributions include the kernel configuration file as /boot/config-<kernel version number>. So, you could run this command:



    $ grep XHCI /boot/config-$(uname -r)
    CONFIG_USB_XHCI_HCD=m
    CONFIG_USB_XHCI_PCI=m
    # CONFIG_USB_XHCI_PLATFORM is not set


    Here, both xhci_hcd and xhci_pci are configured to be available as modules. If the lines would say ...=y instead, the USB 3 support would be compiled into the main kernel.



    PCI ID 1022:43b5, subsystem ID 1b21:1062 is an AHCI SATA (or eSATA) controller, which is already covered by module ahci.



    You can look up PCI IDs in PCI ID Repository.



    If a driver has been specified by vendor/product IDs, you could use /sbin/modprobe -c | grep '<vendor ID>.*<product ID>'. If you get back a line like this, you've found a match:



    alias pci:v0000<vendor ID>:d0000<product ID>sv... <module name>


    This information comes from /lib/modules/modules.alias[.bin], which is generated by the depmod command from the device support information embedded in the kernel modules themselves (defined in the source code with a MODULE_DEVICE_TABLE macro). You can also use modinfo <module name> | grep alias to view the hardware support claimed by a particular module.



    However, not all modules are specified by vendor/product IDs. Some drivers will cover an entire class of devices; for example, the xhci_pci module claims support of PCI base class 0x0C, subclass 0x03, interface 0x30... which maps to "Serial bus controller", "USB controller" and "XHCI" respectively. This is expressed as



    alias:          pci:v*d*sv*sd*bc0Csc03i30*


    Note that you should not normally need to do any of these lookups manually unless you've blacklisted some modules or the auto-detection fails for some reason. For example, when the Linux kernel detects the original poster's USB 3 controller, it will cause (the equivalent of) the following command to be executed:



    modprobe pci:v00001022d000043b9sv1b21sd1142bc0Csc03i30


    which contains all the hardware vendor/device/class/subclass/interface IDs available for the device. If one of the wildcarded aliases on record in modprobe configuration matches this string, the respective module will get loaded automatically.



    For USB devices (and indeed for any autoprobeable buses), there is a similar system of module aliases, and a USB ID repository.



    If you don't have the appropriate module compiled on your system, your best bet is to use the PCI ID repository to identify the device or the chip used within it. Sometimes the repository entry identifies the Linux kernel module that will provide support for it. If that information is not present, you may need to google using the device/chip model; this will usually allow you to find any alternative/experimental driver modules that have not (yet?) been included in the standard kernel.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 23 '18 at 19:46

























    answered Dec 23 '18 at 18:33









    telcoMtelcoM

    16.3k12144




    16.3k12144








    • 2





      Thanks, you are correct. xhci_hcd module was required. I just found it using live usb with another version of linux. lspci -k command showed me the module name. But this doesn't feel like a true way to resolve similar problems. The question still remains - what is a consistent way to find out kernel module given the hardware id's?

      – lesnik
      Dec 23 '18 at 18:53














    • 2





      Thanks, you are correct. xhci_hcd module was required. I just found it using live usb with another version of linux. lspci -k command showed me the module name. But this doesn't feel like a true way to resolve similar problems. The question still remains - what is a consistent way to find out kernel module given the hardware id's?

      – lesnik
      Dec 23 '18 at 18:53








    2




    2





    Thanks, you are correct. xhci_hcd module was required. I just found it using live usb with another version of linux. lspci -k command showed me the module name. But this doesn't feel like a true way to resolve similar problems. The question still remains - what is a consistent way to find out kernel module given the hardware id's?

    – lesnik
    Dec 23 '18 at 18:53





    Thanks, you are correct. xhci_hcd module was required. I just found it using live usb with another version of linux. lspci -k command showed me the module name. But this doesn't feel like a true way to resolve similar problems. The question still remains - what is a consistent way to find out kernel module given the hardware id's?

    – lesnik
    Dec 23 '18 at 18:53













    2














    If the module isn't built into the kernel (on RedHat 7 and variants, XHCI_HCD is not loaded as a module, but part of the base image) you can look at the modules.aliases file for your kernel.



    e.g.



    % grep 1B21 /lib/modules/$(uname -r)/modules.alias
    alias pci:v00001B21d00000612sv*sd*bc*sc*i* ahci
    alias pci:v00001B21d00000611sv*sd*bc*sc*i* ahci
    alias pci:v00001B21d00000602sv*sd*bc*sc*i* ahci
    alias pci:v00001B21d00000601sv*sd*bc*sc*i* ahci


    We can see the "v"endor ID, and "d"evice ID values in this file, and the corresponding module ("ahci") that should be loaded.



    We can verify this module handles those drivers:



    % modinfo /usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/drivers/ata/ahci.ko.xz
    filename: /usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/drivers/ata/ahci.ko.xz
    version: 3.0
    license: GPL
    description: AHCI SATA low-level driver
    author: Jeff Garzik
    retpoline: Y
    rhelversion: 7.6
    srcversion: 4BCC52C20C316AF69F3584A
    ....
    alias: pci:v00001B21d00000612sv*sd*bc*sc*i*
    alias: pci:v00001B21d00000611sv*sd*bc*sc*i*
    alias: pci:v00001B21d00000602sv*sd*bc*sc*i*
    alias: pci:v00001B21d00000601sv*sd*bc*sc*i*
    ...
    depends: libahci,libata
    intree: Y
    vermagic: 3.10.0-957.1.3.el7.x86_64 SMP mod_unload modversions
    signer: CentOS Linux kernel signing key
    sig_key: E7:CE:F3:61:3A:9B:8B:D0:12:FA:E7:49:82:72:15:9B:B1:87:9C:65
    sig_hashalgo: sha256
    parm: marvell_enable:Marvell SATA via AHCI (1 = enabled) (int)


    The values in the modules.alias file correspond to:



     v     (vendor)
    d (device)
    sv (subvendor)
    sd (subdevice)
    bc (bus class)
    sc (bus subclass)
    i (interface)





    share|improve this answer




























      2














      If the module isn't built into the kernel (on RedHat 7 and variants, XHCI_HCD is not loaded as a module, but part of the base image) you can look at the modules.aliases file for your kernel.



      e.g.



      % grep 1B21 /lib/modules/$(uname -r)/modules.alias
      alias pci:v00001B21d00000612sv*sd*bc*sc*i* ahci
      alias pci:v00001B21d00000611sv*sd*bc*sc*i* ahci
      alias pci:v00001B21d00000602sv*sd*bc*sc*i* ahci
      alias pci:v00001B21d00000601sv*sd*bc*sc*i* ahci


      We can see the "v"endor ID, and "d"evice ID values in this file, and the corresponding module ("ahci") that should be loaded.



      We can verify this module handles those drivers:



      % modinfo /usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/drivers/ata/ahci.ko.xz
      filename: /usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/drivers/ata/ahci.ko.xz
      version: 3.0
      license: GPL
      description: AHCI SATA low-level driver
      author: Jeff Garzik
      retpoline: Y
      rhelversion: 7.6
      srcversion: 4BCC52C20C316AF69F3584A
      ....
      alias: pci:v00001B21d00000612sv*sd*bc*sc*i*
      alias: pci:v00001B21d00000611sv*sd*bc*sc*i*
      alias: pci:v00001B21d00000602sv*sd*bc*sc*i*
      alias: pci:v00001B21d00000601sv*sd*bc*sc*i*
      ...
      depends: libahci,libata
      intree: Y
      vermagic: 3.10.0-957.1.3.el7.x86_64 SMP mod_unload modversions
      signer: CentOS Linux kernel signing key
      sig_key: E7:CE:F3:61:3A:9B:8B:D0:12:FA:E7:49:82:72:15:9B:B1:87:9C:65
      sig_hashalgo: sha256
      parm: marvell_enable:Marvell SATA via AHCI (1 = enabled) (int)


      The values in the modules.alias file correspond to:



       v     (vendor)
      d (device)
      sv (subvendor)
      sd (subdevice)
      bc (bus class)
      sc (bus subclass)
      i (interface)





      share|improve this answer


























        2












        2








        2







        If the module isn't built into the kernel (on RedHat 7 and variants, XHCI_HCD is not loaded as a module, but part of the base image) you can look at the modules.aliases file for your kernel.



        e.g.



        % grep 1B21 /lib/modules/$(uname -r)/modules.alias
        alias pci:v00001B21d00000612sv*sd*bc*sc*i* ahci
        alias pci:v00001B21d00000611sv*sd*bc*sc*i* ahci
        alias pci:v00001B21d00000602sv*sd*bc*sc*i* ahci
        alias pci:v00001B21d00000601sv*sd*bc*sc*i* ahci


        We can see the "v"endor ID, and "d"evice ID values in this file, and the corresponding module ("ahci") that should be loaded.



        We can verify this module handles those drivers:



        % modinfo /usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/drivers/ata/ahci.ko.xz
        filename: /usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/drivers/ata/ahci.ko.xz
        version: 3.0
        license: GPL
        description: AHCI SATA low-level driver
        author: Jeff Garzik
        retpoline: Y
        rhelversion: 7.6
        srcversion: 4BCC52C20C316AF69F3584A
        ....
        alias: pci:v00001B21d00000612sv*sd*bc*sc*i*
        alias: pci:v00001B21d00000611sv*sd*bc*sc*i*
        alias: pci:v00001B21d00000602sv*sd*bc*sc*i*
        alias: pci:v00001B21d00000601sv*sd*bc*sc*i*
        ...
        depends: libahci,libata
        intree: Y
        vermagic: 3.10.0-957.1.3.el7.x86_64 SMP mod_unload modversions
        signer: CentOS Linux kernel signing key
        sig_key: E7:CE:F3:61:3A:9B:8B:D0:12:FA:E7:49:82:72:15:9B:B1:87:9C:65
        sig_hashalgo: sha256
        parm: marvell_enable:Marvell SATA via AHCI (1 = enabled) (int)


        The values in the modules.alias file correspond to:



         v     (vendor)
        d (device)
        sv (subvendor)
        sd (subdevice)
        bc (bus class)
        sc (bus subclass)
        i (interface)





        share|improve this answer













        If the module isn't built into the kernel (on RedHat 7 and variants, XHCI_HCD is not loaded as a module, but part of the base image) you can look at the modules.aliases file for your kernel.



        e.g.



        % grep 1B21 /lib/modules/$(uname -r)/modules.alias
        alias pci:v00001B21d00000612sv*sd*bc*sc*i* ahci
        alias pci:v00001B21d00000611sv*sd*bc*sc*i* ahci
        alias pci:v00001B21d00000602sv*sd*bc*sc*i* ahci
        alias pci:v00001B21d00000601sv*sd*bc*sc*i* ahci


        We can see the "v"endor ID, and "d"evice ID values in this file, and the corresponding module ("ahci") that should be loaded.



        We can verify this module handles those drivers:



        % modinfo /usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/drivers/ata/ahci.ko.xz
        filename: /usr/lib/modules/3.10.0-957.1.3.el7.x86_64/kernel/drivers/ata/ahci.ko.xz
        version: 3.0
        license: GPL
        description: AHCI SATA low-level driver
        author: Jeff Garzik
        retpoline: Y
        rhelversion: 7.6
        srcversion: 4BCC52C20C316AF69F3584A
        ....
        alias: pci:v00001B21d00000612sv*sd*bc*sc*i*
        alias: pci:v00001B21d00000611sv*sd*bc*sc*i*
        alias: pci:v00001B21d00000602sv*sd*bc*sc*i*
        alias: pci:v00001B21d00000601sv*sd*bc*sc*i*
        ...
        depends: libahci,libata
        intree: Y
        vermagic: 3.10.0-957.1.3.el7.x86_64 SMP mod_unload modversions
        signer: CentOS Linux kernel signing key
        sig_key: E7:CE:F3:61:3A:9B:8B:D0:12:FA:E7:49:82:72:15:9B:B1:87:9C:65
        sig_hashalgo: sha256
        parm: marvell_enable:Marvell SATA via AHCI (1 = enabled) (int)


        The values in the modules.alias file correspond to:



         v     (vendor)
        d (device)
        sv (subvendor)
        sd (subdevice)
        bc (bus class)
        sc (bus subclass)
        i (interface)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 23 '18 at 19:25









        Stephen HarrisStephen Harris

        25.5k24477




        25.5k24477






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f490625%2fhow-to-find-kernel-module-for-a-given-device%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Plaza Victoria

            In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

            How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...