Now we want to plug in the hardware that we want to find out about, and immediately issue the previous commands again, but with different filenames
sudo cp /var/log/messages messages.after
sudo lsmod > lsmod.after
Now we have copies of the kernel log and the loaded module list from before and after the device was plugged in. Now let's see what changed with the following commands.
diff lsmod.before lsmod.after
In this case I plugged in my new usb to serial port dongle. The output of the previous commands looks something like this.
ftdi_sio               31880  0 
usbserial              30824  1 ftdi_sio
usbcore               120964  3 usb_storage,uhci_hcd
usbcore               120964  5 ftdi_sio,usbserial,usb_storage,uhci_hcd
From this, we know that the ftdi_sio and the usbserial drivers have been loaded into the kernel since we plugged in the device, so most likely these are the drivers that the new device is using. Now lets look at the new entries in the kernel log with the following command
diff messages.before messages.after