How do I find out which driver a piece of hardware is using?

Today I'm trying to figure out which driver is best for my USB wireless dongle. Everywhere I look I just see Ralink STA but this isn't telling me which module this actually is.

I'm sure there's a way of looking it up but the computer should be able to tell me, shouldn't it?

Meta: This question is open to any piece of hardware, not just my wireless card. It would be helpful if we had a thread of useful diagnostic procedures so that other people can find out what's going on with their hardware.


lshw

lshw is a very useful tool for finding details about all your hardware. It it should be able to tell you all sorts of nonsense - some useful, some not. In my case here's what sudo lshw -c network gave me about my wired card:

  *-network
       description: Ethernet interface
       product: RTL8111/8168B PCI Express Gigabit Ethernet controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:09:00.0
       logical name: eth1
       version: 03
       serial: xx:xx:xx:xx:xx:xx
       size: 10Mbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list rom ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s
       resources: ...

The driver is buried in the configuration: section near the end.

If you just want a quick list of the modules in use, you could use this:

sudo lshw | grep -Eo 'driver=[^ ]+' | sort -u | cut -d\= -f2

You can install hardinfo and browse the various categories of hardware to get info on which driver each device in the list uses.

Screenshot:
enter image description here