Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I know about lsmod, but how do I figure out which driver does what?

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted
$ readlink /sys/class/net/wlan0/device/driver
../../../../bus/pci/drivers/ath5k

In other words, the /sys hierarchy for the device (/sys/class/net/$interface/device) contains a symbolic link to the /sys hierarchy for the driver. There you'll also find a symbolic link to the /sys hierarchy for the module, if applicable. This applies to most devices, not just wireless interfaces.

share|improve this answer
1  
Or basename $( readlink /sys/class/net/eth0/device/driver ). –  mattdm Feb 23 '11 at 0:09
add comment

Maybe there's a better way, but I've used lshw -class network (as root) and it gives me this output:

  *-network               
       description: Ethernet interface
       product: 82566MM Gigabit Network Connection
       vendor: Intel Corporation
       physical id: 19
       bus info: pci@0000:00:19.0
       logical name: eth0
       version: 03
       serial: 00:a0:d1:a3:87:c8
       size: 1GB/s
       capacity: 1GB/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=1.0.2-k2 duplex=full firmware=0.3-0 ip=192.168.2.206 latency=0 link=yes multicast=yes port=twisted pair speed=1GB/s
       resources: irq:29 memory:fc300000-fc31ffff memory:fc325000-fc325fff ioport:1840(size=32)
  *-network
       description: Wireless interface
       product: PRO/Wireless 4965 AG or AGN [Kedron] Network Connection
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:06:00.0
       logical name: wlan0
       version: 61
       serial: 00:1d:e0:69:28:07
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlagn ip=192.168.0.104 latency=0 multicast=yes wireless=IEEE 802.11abgn
       resources: irq:31 memory:c8000000-c8001fff
  *-network DISABLED
       description: Ethernet interface
       physical id: 3
       logical name: vboxnet0
       serial: 0a:00:27:00:00:00
       capabilities: ethernet physical
       configuration: broadcast=yes multicast=yes

You can grep for driver from that output. In my case I use lsmod | grep iwlagn, giving me:

iwlagn                 63559  0 
iwlcore                67702  1 iwlagn
mac80211              123574  2 iwlagn,iwlcore
cfg80211               87657  3 iwlagn,iwlcore,mac80211

Don't ask me what each of those mean :)

share|improve this answer
    
Thanks. I had tried using lshw, but the driver was lost within all the other configuration. :) –  apoorv020 Feb 22 '11 at 9:11
    
PS, the 4th column is the dependencies column and 3rd column is the sum of these dependencies. One driver typically consists of several different .ko files, each of which has a corresponding in lsmod. –  apoorv020 Feb 22 '11 at 9:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.