LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   find association between HW device and driver/module (https://www.linuxquestions.org/questions/linux-hardware-18/find-association-between-hw-device-and-driver-module-908622/)

m4rtin 10-17-2011 12:22 PM

find association between HW device and driver/module
 
What techniques to use in order to find driver/module associated with a hardware device? For example I have two NIC's in my PC. Kernel ring buffer doesn't give out much helpful information this time:

Code:

root:~ # dmesg | egrep "eth1|eth2"
ADDRCONF(NETDEV_UP): eth1: link is not ready
tg3: eth1: Link is up at 1000 Mbps, full duplex.
tg3: eth1: Flow control is off for TX and off for RX.
ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
eth1: no IPv6 routers present
root:~ #

One could check the lsmod output, but not always the names are self-explanatory. I could do:

Code:

for module in `lsmod | cut -f1 -d " "`; do modinfo $module; done
..but this is not obviously the smartest solution either :)

What tricks/software to you use in order to associate module with hardware device? :rolleyes:

TobiSGD 10-17-2011 12:40 PM

Try
Code:

lspci -vv
In the last line for every device it shows which modules are used.

macemoneta 10-17-2011 12:55 PM

Actually, your first command gave you the result. The tg3 kernel driver is used for eth1. You can also:
Code:

ls -ld /sys/class/net/eth0/device/driver/module/drivers/pci*
lrwxrwxrwx. 1 root root 0 Oct 17 13:48 /sys/class/net/eth0/device/driver/module/drivers/pci:r8169 -> ../../../bus/pci/drivers/r8169


business_kid 10-17-2011 01:56 PM

Rather than digging in /sys, I use lspci -n. then google the pci id, e.g. google 1039:0900 for my network card, and you won;t even have to look up a page.

anomie 10-17-2011 01:58 PM

This is what ethtool(8) is for, e.g.:
Code:

# ethtool -i eth1

m4rtin 10-18-2011 09:07 AM

Thank you for all the replies! I upgraded tg3.ko(driver for Broadcom Corporation NetXtreme BCM5722 NIC) from version 3.91 to 3.116j remotely over SSH. I did:

Code:

rmmod tg3; sleep 5; insmod /root/user/Server/Linux/Driver/tg3-3.116j/tg3.ko
..and according to "ethtool -i eth1" I have the new module in use:

Code:

IBM:~ # ethtool -i eth1
driver: tg3
version: 3.116j
firmware-version: 5722-v3.09, ASFIPMI v6.03
bus-info: 0000:06:00.0
IBM:~ #

However, is this really in use? I mean there wasn't even a outage in SSH connection and no configuration was lost :rolleyes:


All times are GMT -5. The time now is 05:22 AM.