Correct driver for a device

Here’s a tip to check whether your piece of hardware is supported by the installed Linux kernel modules on your machine.

First, check lspci output for let’s say a wireless card:

$ lspci | grep -i wireless
01:00.0 Network controller: Atheros Communications Inc. AR928X Wireless Network Adapter (PCI-Express) (rev 01)

Note the number 01:00.0 in lspci output, in which 01 represents the bus number the device is attached to, 00 is the device number and final 0 is PCI device function. To get more information on that device we could list the entries in /sys/bus/pci/devices/0000:01:00.0 directory of sysfs (a RAM file system that exports kernel structures, attributes and their inner links. udev uses sysfs also to create dynamic device files). lspci actually reads sysfs.

Next, we print raw (-n option) PCI identification data that includes the previous numbers:

$ lspci -n | grep 01:00.0
01:00.0 0280: 168c:002a (rev 01)

These numbers are from /usr/share/misc/pci.ids file. Lets brake down the numbers:

  • 01:00.0 – 01 is bus number, 00 device number, 0 device function
  • 0280 – device class
  • 168c – vendor ID
  • 002a – device ID

We use the vendor ID and device ID numbers and compare them to a modinfo of kernel drivers:

$ find /lib/modules/$(uname -r)/kernel/drivers -type f -exec modinfo "{}" \; | grep -B 200 -i 168c | grep -B 50 -i 002a | grep filename
filename:       /lib/modules/2.6.31-23-generic/kernel/drivers/net/wireless/ath/ath5k/ath5k.ko
filename:       /lib/modules/2.6.31-23-generic/kernel/drivers/net/wireless/ath/ath9k/ath9k.ko

So, my wireless card is supported by the ath9k driver. If I didn’t got the output from modinfo, it would probably mean that the hardware is not supported and that I need to get the driver from the device vendor. I could also search only for the vendor ID to get some results but that could yield some unexpected results I suppose. It could also mean that I have an old pci id lookup table, and should try to update it by running:

$ update-pciids

Then see if lspci will print out more descriptive information about the device and try to take it from there. If you are using Debian stable distribution, try installing a newer kernel from, which may support your hardware.

Comments are closed.