Find correct kernel module for your device the geek’s way

tux_compI remember the time when I just got introduced to Linux and I used to spend hours searching for the correct driver for different devices in the desktop. I guess many have faced the same and it was indeed a major turn-off for end-users. Driver support on Linux has become an out of the box experience nowadays. Still, many of the drivers are reverse-engineered and sometimes it’s hard to determine which one supports your device. There are ways to determine the right driver methodically. I was thinking of writing on this when I found that the following article addresses this very well:
Determining the correct module from scratch

In addition, here’s a way to determine if a driver supports your device using the module pci aliases. This is particularly helpful if you already have a list of some probable driver candidates. For example, a partial hwinfo of my laptop soundcard shows the following:

$ hwinfo --sound
12: PCI 1b.0: 0403 Audio device
[Created at pci.318]
Unique ID: u1Nb.9MNd7jCnbx4
SysFS ID: /devices/pci0000:00/0000:00:1b.0
SysFS BusID: 0000:00:1b.0
Hardware Class: sound
Model: "Intel Audio device"
Vendor: pci 0x8086 "Intel Corporation"
Device: pci 0x1e20
SubVendor: pci 0x104d "Sony Corporation"
SubDevice: pci 0x9099
Revision: 0x04
...
Memory Range: 0xc4410000-0xc4413fff (rw,non-prefetchable)
IRQ: 46 (232 events)
Module Alias: "pci:v00008086d00001E20sv0000104Dsd00009099bc04sc03i00"
...

To check if the Intel HDA driver supports it I run modinfo on it:

$ modinfo snd_hda_intel
filename: /lib/modules/3.10.3-031003-generic/kernel/sound/pci/hda/snd-hda-intel.ko
description: Intel HDA driver
license: GPL
srcversion: 2319D999679B5068E5D96C9
alias: pci:v00001022d*sv*sd*bc04sc03i00*
...
alias: pci:v00008086d00008C20sv*sd*bc*sc*i*
alias: pci:v00008086d00001E20sv*sd*bc*sc*i*
alias: pci:v00008086d00001D20sv*sd*bc*sc*i*
alias: pci:v00008086d00001C20sv*sd*bc*sc*i*
depends: snd-hda-codec,snd-pcm,snd,snd-page-alloc
...

Some strings in the alias are replaced by the * wildcard (e.g.: SubVendor, SubDevice etc.). As you see, I do have a match for the alias with 1E20 and hence this driver supports my device.

Note that hwinfo might not be installed by default on your distro and you may need to install it.

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s