Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
04-06-2008, 05:54 AM
|
#1
|
|
Member
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 798
Rep: 
|
How do I find out which module drives which device?
Hi Chaps,
I have a peice of hardware that is failing while my laptop is running. I want to unload and reload the module for it to see if the driver is getting upset, however when I lsmod I can't find any name that even vaguely resembles the name of the hardware device I get from lspci.
So how do I unequivocally identify the driver/module that is currently handling any specific device?
Cheers
Pete
|
|
|
|
04-06-2008, 07:57 AM
|
#2
|
|
HCL Maintainer
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926
Rep: 
|
|
|
|
|
04-06-2008, 08:15 AM
|
#3
|
|
Moderator
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
For many devices, the Kernel source documentation will indicate which devices the driver works with.
You an also use google for the answer. Look at the output of "lspci -v" and then "lspci -n". The latter will contain the manufactures code with will identify the device controller.
|
|
|
|
04-06-2008, 09:03 AM
|
#4
|
|
Member
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 798
Original Poster
Rep: 
|
The chapter links on that site don't appear to work at the moment. I'll try again later.
In the meantime, I used lspci to find out the device type, in this case a bcm5755. Google reveals this page http://hardware4linux.info/component/21350/
which says that the module supporting this device is tg3, and sure enough I have a module loaded called tg3.
However gnome network manager, which is giving me the occasional odd behaviour, says that the driver being used is iwl4965, and again lsmod shows that I have that running too.
The documentation will only tell me which driver is _intended_ to be used for a device, not which one is actually being used. Given how explicit the info is given by lspci and the like I assumed that there would be a simple way of verifying which driver was _actually_ associated with which piece of hardware, hence the question.
Cheers
Pete
|
|
|
|
04-06-2008, 09:15 AM
|
#5
|
|
HCL Maintainer
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926
Rep: 
|
Get the pdf tarball.
The output of "lspci -v" shows which module the kernel is presently using. The tg3 (Tigon 3) module is for a Broadcom wired NIC, and iwl4965 is for a Intel wireless NIC.
I'll bet "lspci | grep -i ethernet" will confirm that.
Do you not get output like this:
Code:
root@silas:~# lspci -v
<snip>
00:0a.0 Ethernet controller: Marvell Technology Group Ltd. 88E8001 Gigabit Ethernet Controller (rev 13)
Subsystem: ASUSTeK Computer Inc. Marvell 88E8001 Gigabit Ethernet Controller (Asus)
Flags: bus master, 66MHz, medium devsel, latency 64, IRQ 18
Memory at fde00000 (32-bit, non-prefetchable) [size=16K]
I/O ports at ec00 [size=256]
Expansion ROM at fdd00000 [disabled] [size=128K]
Capabilities: [48] Power Management version 2
Capabilities: [50] Vital Product Data <?>
Kernel driver in use: skge
Kernel modules: skge
Last edited by Bruce Hill; 04-06-2008 at 09:20 AM.
|
|
|
|
04-06-2008, 09:46 AM
|
#6
|
|
Member
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 798
Original Poster
Rep: 
|
Interestingly, no it only gives me this -
09:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5755M Gigabit Ethernet PCI Express (rev 02)
Subsystem: Dell Unknown device 01f9
Flags: bus master, fast devsel, latency 0, IRQ 17
Memory at fe7f0000 (64-bit, non-prefetchable) [size=64K]
Capabilities: [48] Power Management version 3
Capabilities: [50] Vital Product Data
Capabilities: [58] Vendor Specific Information
Capabilities: [e8] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0 Enable-
Capabilities: [d0] Express Endpoint IRQ 0
Which doesn't show the kernel drivers used. However looking closer at this output does reveal that I made a stupid assed assumption. That because my old laptop had a broadcom wireless controller the broadcom device in this one was also the wireless and then saw what I expected to see when I ran lspci. On closer inspection the following device shows -
0c:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN Network Connection (rev 61)
Subsystem: Intel Corporation Unknown device 1121
Flags: bus master, fast devsel, latency 0, IRQ 17
Memory at fe8fe000 (64-bit, non-prefetchable) [size=8K]
Capabilities: [c8] Power Management version 3
Capabilities: [d0] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0 Enable-
Capabilities: [e0] Express Endpoint IRQ 0
whoops.
thanks for your help.
cheers
Pete
|
|
|
|
04-06-2008, 09:53 AM
|
#7
|
|
HCL Maintainer
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926
Rep: 
|
Pete,
I'm not sure when "lspci -v" started showing the modules,
or if that's a kernel option, or what. Maybe jschiwal can
enlighten us on that.
|
|
|
|
04-06-2008, 10:35 AM
|
#8
|
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,797
|
lspci -v does not give me anything on driver, modules, or kernel.
Nor does lspci -vv or lspci -vvv
|
|
|
|
04-06-2008, 10:41 AM
|
#9
|
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,797
|
I don't know if this might be useful. This goes through a directory and determines which of the drivers appear in lsmod:
for i in `ls -R|sed '/^\./d'`; do lsmod|grep `echo $i|cut -d. -f1`;done
Run it (for example) in /lib/modules/`uname -r`/kernel/drivers
To test this, I tried to find the driver that runs my ethernet card--I could not find it (perhaps this means that it is built into the kernel??)
|
|
|
|
04-06-2008, 11:13 AM
|
#10
|
|
Moderator
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Does /usr/src/linux/Documentation/networking/00-INDEX have any useful info?
|
|
|
|
04-06-2008, 11:27 AM
|
#11
|
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,572
|
In Suse, run '/usr/sbin/hwinfo --netcard'. You will get output like this:
Quote:
/usr/sbin/hwinfo --netcard
30: PCI 106.0: 0200 Ethernet controller
[Created at pci.273]
Unique ID: rBUF.ZnUy5NLS7T1
Parent ID: WL76.vuIf6LvchL4
SysFS ID: /devices/pci0000:00/0000:00:09.0/0000:01:06.0
SysFS BusID: 0000:01:06.0
Hardware Class: network
Model: "D-Link VT6105 [Rhine-III]"
Vendor: pci 0x1106 "VIA Technologies, Inc."
Device: pci 0x3106 "VT6105 [Rhine-III]"
SubVendor: pci 0x1186 "D-Link System Inc"
SubDevice: pci 0x1406
Revision: 0x86
Driver: "via-rhine"
Device File: eth0
I/O Ports: 0xac00-0xacff (rw)
Memory Range: 0xfdeff000-0xfdeff0ff (rw,non-prefetchable)
Memory Range: 0x00000000-0x0000ffff (ro,prefetchable,disabled)
IRQ: 66 (1525107 events)
HW Address: 00:1b:11:0c:d6:22
Driver Info #0:
Driver Status: via-rhine is active
Driver Activation Cmd: "modprobe via-rhine"
Config Status: cfg=no, avail=yes, need=no, active=unknown
Attached to: #18 (PCI bridge)
|
|
|
|
|
04-06-2008, 11:45 AM
|
#12
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
baldy3105 seems to have solved his problem, but the Q "How do I find out which module drives which device?" is still interesting.
Isn't this sort of information available from sysfs ?
Quote:
To illustrate this, consider a PCI network device
and driver. When the system boots, the PCI de-
vice is discovered and a sysfs directory is cre-
ated for it, long before it is bound to a specific
driver. At some later time, the network driver
is loaded, which may or may not bind to any
devices. This is a different object type than the
physical PCI device represents, so a new direc-
tory is created for it.
Their association is illustrated in Table 12.
Shown is the driver’s directory in sysfs, which
is named after the name of the driver module.
This contains a symbolic link that points to the
devices to which it is bound (in this case, just
one). The name of the symbolic link and the
target directory are the same, and based on the
physical bus ID of the device.
|
The above is from "The sysfs Filesystem" by Patrick Mochel
Here's a link:
http://www.kernel.org/pub/linux/kern...005/mochel.pdf
|
|
|
|
04-07-2008, 04:07 AM
|
#13
|
|
Member
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 798
Original Poster
Rep: 
|
I'm not sure about "solved" but I'm not stuck anymore! I may raise further questions but not unless I get stuck again.
However I was suprised that there is not some sort of record, say in dmesg, of modules grabbing devices, succesfully or otherwise. Just a one-liner recording the module name, the device it tried to associate with and success or failure would be enough.
Otherwise I'm reduced to rmmod'ing things to see what breaks, which isn't ideal!
Thanks again, you guys are always totally helpfull.
Pete
|
|
|
|
04-07-2008, 08:02 AM
|
#14
|
|
HCL Maintainer
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926
Rep: 
|
Just decided to less the Changelog for pciutils and see when this happened:
Code:
mingdao@silas:~$ less /usr/doc/pciutils-2.2.10/ChangeLog
<snip>
2007-11-06 Martin Mares <address-munged>
* Released as 2.2.9.
* lspci.c: Added a new switch `-k' which requests printing
of information on kernel drivers attached to each device
and on kernel modules reporting the ability to handle the
device. So far, this is supported only on Linux with the
sysfs back-end, so it is implemented internally in the lspci
instead of the libpci. Thanks to Anicka <address-munged>
for help.
And from "man lspci"
Code:
OPTIONS
<snip>
-k Show kernel drivers handling each device and also kernel modules capable of handling it. Turned on by default when -v is given in the normal mode of output.
(Currently works only on Linux with kernel 2.6 or newer.)
So now we know, the rest ... of the story.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:30 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|