Linux: How to find the device driver used for a device?
If my target has one device connected and many drivers for that device loaded, how can I understand what device is using which driver?
Example. I want to find the driver for my Ethernet card:
$ sudo lspci ... 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01) $ find /sys | grep drivers.*02:00 /sys/bus/pci/drivers/r8169/0000:02:00.0
First I need to find coordinates of the device using
lspci; then I find driver that is used for the devices with these coordinates.
`lspci -nk` will show you attached drivers. In general the sysfs is the right place to search for.
I know the OP asked for "drivers being used", but what if the driver is not installed nor being used? How to find out just by the `vendorID:productID`? Also, what if it is not a PCI device, and you only see it in `lsusb` for example?
@DrBeco: But if driver is not installed, what do you want to find? You should just google in this case
Well, not an option if you are trying to find the correct driver to load for a bunch of network cards that are not working (so, no google, unless you keep moving to another machine, or booting something that work, which takes time)
And if it's USB? Is there a generic way to do this? Looking at /sys or /proc or something?