En este artículo voy a explicar de qué forma se puede determinar qué driver utiliza un determinado dispositivo en GNU/Linux.

En GNU/Linux, existen diferentes herramientas para listar información sobre distintos tipos de dispositivos: lsblk (dispositivos de bloque, generalmente discos y particiones), lsdev (aliases), lspci (dispositivos PCI), lspcmcia (dispositivos PCMCIA), lsscsi (dispositivos SCSI, generalmente dispositivos de almacenamiento como discos, lectoras, unidades de cinta, etc.) y lsusb (dispositivos USB).

Comúnmente la herramienta que se utiliza para determinar qué drivers (controladores, en español) están siendo utilizados por el sistema es lsmod. Esta herramienta lista los módulos cargados en el kernel Linux. Es una técnica adecuada, ya que los drivers de dispositivo suelen implementarse como módulos del kernel. Aunque es no es tan simple determinar qué dispositivo está utilizando cada módulo.

Si necesitamos saber qué driver está utilizando un dispositivo PCI o USB, lo mejor es recurrir a las herramientas lspci y lsusb respectivamente. Ambas cuentan con opciones para mostrar información detallada acerca de cada dispositivo.

Para los dispositivos PCI, se debe utilizar el comando lspci -v:

[13:04 root@vaio emi] > lspci -v
00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, fast devsel, latency 0
        Capabilities: [e0] Vendor Specific Information: Len=0c 

00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=01, subordinate=06, sec-latency=0
        I/O behind bridge: 00003000-00003fff
        Memory behind bridge: c0000000-c0ffffff
        Prefetchable memory behind bridge: 00000000b0000000-00000000bfffffff
        Capabilities: [88] Subsystem: Sony Corporation Device 90ab
        Capabilities: [80] Power Management version 3
        Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
        Capabilities: [a0] Express Root Port (Slot+), MSI 00
        Capabilities: [100] Virtual Channel
        Capabilities: [140] Root Complex Link
        Capabilities: [d94] #19
        Kernel driver in use: pcieport
        Kernel modules: shpchp

00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) (prog-if 30 [XHCI])
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, medium devsel, latency 0, IRQ 43
        Memory at c1300000 (64-bit, non-prefetchable) [size=64K]
        Capabilities: [70] Power Management version 2
        Capabilities: [80] MSI: Enable+ Count=1/8 Maskable- 64bit+
        Kernel driver in use: xhci_hcd
        Kernel modules: xhci_hcd

00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04)
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, fast devsel, latency 0, IRQ 47
        Memory at c1314000 (64-bit, non-prefetchable) [size=16]
        Capabilities: [50] Power Management version 3
        Capabilities: [8c] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Kernel driver in use: mei_me
        Kernel modules: mei_me

00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04) (prog-if 20 [EHCI])
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, medium devsel, latency 0, IRQ 16
        Memory at c1319000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [50] Power Management version 2
        Capabilities: [58] Debug port: BAR=1 offset=00a0
        Capabilities: [98] PCI Advanced Features
        Kernel driver in use: ehci-pci
        Kernel modules: ehci_pci

00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, fast devsel, latency 0, IRQ 42
        Memory at c1310000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: [50] Power Management version 2
        Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
        Capabilities: [100] Virtual Channel
        Capabilities: [130] Root Complex Link
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd_hda_intel

00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=07, subordinate=07, sec-latency=0
        Memory behind bridge: c1200000-c12fffff
        Prefetchable memory behind bridge: 00000000c1500000-00000000c15fffff
        Capabilities: [40] Express Root Port (Slot+), MSI 00
        Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
        Capabilities: [90] Subsystem: Sony Corporation Device 90ab
        Capabilities: [a0] Power Management version 2
        Kernel driver in use: pcieport
        Kernel modules: shpchp

00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=08, subordinate=08, sec-latency=0
        Memory behind bridge: c1100000-c11fffff
        Capabilities: [40] Express Root Port (Slot+), MSI 00
        Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
        Capabilities: [90] Subsystem: Sony Corporation Device 90ab
        Capabilities: [a0] Power Management version 2
        Kernel driver in use: pcieport
        Kernel modules: shpchp

00:1c.2 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 3 (rev c4) (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0
        Bus: primary=00, secondary=09, subordinate=09, sec-latency=0
        I/O behind bridge: 00002000-00002fff
        Prefetchable memory behind bridge: 00000000c1000000-00000000c10fffff
        Capabilities: [40] Express Root Port (Slot+), MSI 00
        Capabilities: [80] MSI: Enable- Count=1/1 Maskable- 64bit-
        Capabilities: [90] Subsystem: Sony Corporation Device 90ab
        Capabilities: [a0] Power Management version 2
        Kernel driver in use: pcieport
        Kernel modules: shpchp

00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04) (prog-if 20 [EHCI])
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, medium devsel, latency 0, IRQ 23
        Memory at c1318000 (32-bit, non-prefetchable) [size=1K]
        Capabilities: [50] Power Management version 2
        Capabilities: [58] Debug port: BAR=1 offset=00a0
        Capabilities: [98] PCI Advanced Features
        Kernel driver in use: ehci-pci
        Kernel modules: ehci_pci

00:1f.0 ISA bridge: Intel Corporation HM76 Express Chipset LPC Controller (rev 04)
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, medium devsel, latency 0
        Capabilities: [e0] Vendor Specific Information: Len=0c 
        Kernel driver in use: lpc_ich
        Kernel modules: lpc_ich

00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04) (prog-if 01 [AHCI 1.0])
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 41
        I/O ports at 4048 [size=8]
        I/O ports at 4054 [size=4]
        I/O ports at 4040 [size=8]
        I/O ports at 4050 [size=4]
        I/O ports at 4020 [size=32]
        Memory at c1317000 (32-bit, non-prefetchable) [size=2K]
        Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
        Capabilities: [70] Power Management version 3
        Capabilities: [a8] SATA HBA v1.0
        Capabilities: [b0] PCI Advanced Features
        Kernel driver in use: ahci

00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04)
        Subsystem: Sony Corporation Device 90ab
        Flags: medium devsel, IRQ 19
        Memory at c1315000 (64-bit, non-prefetchable) [size=256]
        I/O ports at 4000 [size=32]
        Kernel modules: i2c_i801

01:00.0 VGA compatible controller: AMD/ATI [Advanced Micro Devices, Inc.] Thames [Radeon 7550M/7570M/7650M] (prog-if 00 [VGA controller])
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, fast devsel, latency 0, IRQ 48
        Memory at b0000000 (64-bit, prefetchable) [size=256M]
        Memory at c0000000 (64-bit, non-prefetchable) [size=128K]
        I/O ports at 3000 [size=256]
        Expansion ROM at c0040000 [disabled] [size=128K]
        Capabilities: [50] Power Management version 3
        Capabilities: [58] Express Legacy Endpoint, MSI 00
        Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 
        Capabilities: [150] Advanced Error Reporting
        Kernel driver in use: radeon
        Kernel modules: radeon

01:00.1 Audio device: AMD/ATI [Advanced Micro Devices, Inc.] Turks/Whistler HDMI Audio [Radeon HD 6000 Series]
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, fast devsel, latency 0, IRQ 44
        Memory at c0020000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: [50] Power Management version 3
        Capabilities: [58] Express Legacy Endpoint, MSI 00
        Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 
        Capabilities: [150] Advanced Error Reporting
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd_hda_intel

07:00.0 Network controller: Atheros Communications Inc. AR9485 Wireless Network Adapter (rev 01)
        Subsystem: Foxconn International, Inc. Device e044
        Flags: bus master, fast devsel, latency 0, IRQ 16
        Memory at c1200000 (64-bit, non-prefetchable) [size=512K]
        Expansion ROM at c1500000 [disabled] [size=64K]
        Capabilities: [40] Power Management version 2
        Capabilities: [50] MSI: Enable- Count=1/4 Maskable+ 64bit+
        Capabilities: [70] Express Endpoint, MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Virtual Channel
        Capabilities: [160] Device Serial Number 00-00-00-00-00-00-00-00
        Kernel driver in use: ath9k
        Kernel modules: ath9k

08:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01)
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, fast devsel, latency 0, IRQ 45
        Memory at c1100000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Device Serial Number 00-00-00-01-00-4c-e0-00
        Kernel driver in use: rtsx_pci
        Kernel modules: rtsx_pci

09:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 07)
        Subsystem: Sony Corporation Device 90ab
        Flags: bus master, fast devsel, latency 0, IRQ 46
        I/O ports at 2000 [size=256]
        Memory at c1004000 (64-bit, prefetchable) [size=4K]
        Memory at c1000000 (64-bit, prefetchable) [size=16K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 01
        Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
        Capabilities: [d0] Vital Product Data
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Virtual Channel
        Capabilities: [160] Device Serial Number 01-00-00-00-68-4c-e0-00
        Kernel driver in use: r8169
        Kernel modules: r8169


Por ejemplo, si se necesita determinar qué driver está utilizando la tarjeta gráfica "Radeon", localizar la línea que contiene "VGA", "AMD" o "Radeon" y dentro de esa sección mirar el contenido de los campos "Kernel driver in use" y "Kernel modules". Estos indican el driver y módulo del kernel en uso respectivamente. En este caso se observa que el dispositivo "VGA compatible controller: AMD/ATI [Advanced Micro Devices, Inc.] Thames [Radeon 7550M/7570M/7650M]" está utilizando el driver "radeon" implementado mediante el módulo "radeon" (lo cual corresponde al driver open source Mesa).

Para el caso de los dispositivos USB es un poco más complejo. Es necesario cruzar información entre las salidas de los comandos lsusb -v y lsusb -t.

Utilizando lsusb -v | more, buscar el dispositivo deseado, por ejemplo "bluetooth" escribiendo directamente el comando (sin salir de more):

/bluetooth

Automáticamente posiciona el cursor en la primera aparición de la palabra "bluetooth" (no es sensible a mayúsculas):

    594   bDeviceProtocol         1 Bluetooth
    595   bMaxPacketSize0        64
    596   idVendor           0x0489 Foxconn / Hon Hai
    597   idProduct          0xe036 
    598   bcdDevice            0.02
    599   iManufacturer           1 Atheros Communications
    600   iProduct                2 Bluetooth USB Host Controller
    601   iSerial                 3 Alaska Day 2006
    602   bNumConfigurations      1
    603   Configuration Descriptor:
    604     bLength                 9
    605     bDescriptorType         2
    606     wTotalLength          177
    607     bNumInterfaces          2
    608     bConfigurationValue     1
    609     iConfiguration          4 BT HCI
    610     bmAttributes         0xe0
    611       Self Powered
    612       Remote Wakeup
    613     MaxPower              100mA
lines 594-613

Si es el dispositivo deseado (sino presionar la tecla 'N' para buscar la siguiente aparición), mover la pantalla con la flecha hacia arriba para determinar los números de bus (Bus) y dispositivo (Device):

    586 
    587 Bus 003 Device 003: ID 0489:e036 Foxconn / Hon Hai 
    588 Device Descriptor:
    589   bLength                18
    590   bDescriptorType         1
    591   bcdUSB               1.10
    592   bDeviceClass          224 Wireless
    593   bDeviceSubClass         1 Radio Frequency
    594   bDeviceProtocol         1 Bluetooth
    595   bMaxPacketSize0        64
    596   idVendor           0x0489 Foxconn / Hon Hai
    597   idProduct          0xe036 
    598   bcdDevice            0.02
    599   iManufacturer           1 Atheros Communications
    600   iProduct                2 Bluetooth USB Host Controller
    601   iSerial                 3 Alaska Day 2006
    602   bNumConfigurations      1
    603   Configuration Descriptor:
    604     bLength                 9
    605     bDescriptorType         2
lines 586-605

Para no perderse, es necesario saber que la salida de lsusb -v separa los dispositivos mediante una línea en blanco.

Se observa que se trata del bus "003" y dispositivo "003". Salir de more presionando la tecla 'Q'.

Contando con la información de dispositivo es posible ejecutar lsusb -t. Este comando muestra la jerarquía de interconexión de los dispositivos USB actualmente conectados al sistema en forma de árbol, pero además indica qué driver está utilizando cada uno:

[13:30 root@vaio emi] > lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
        |__ Port 2: Dev 3, If 0, Class=Wireless, Driver=btusb, 12M
        |__ Port 2: Dev 3, If 1, Class=Wireless, Driver=btusb, 12M
        |__ Port 3: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
        |__ Port 3: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 2: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 2: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 3: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M

Se sabe que se trata del dispositivo "003" conectado al bus "003". Recorrer el árbol ingresando primero por bus ("Bus 03.") y luego por dispositivo "Dev 3" (este dispositivo en particular tiene dos interfaces, por eso aparece repetido). Finalmente, del campo "Driver" es posible determinar que está utilizando el driver "btusb", el cual, presumiblemente, está implementado por el módulo del kernel "btusb":

[13:44 root@vaio emi] > lsmod | grep btusb
btusb                  16152  0 
bluetooth             220516  3 ath3k,btusb

¡Espero que les sirva!


Tal vez pueda interesarte


Compartí este artículo