I've recently asked myself the same question, just for (probably more common) pluggable hardware keyloggers like e.g. USB or PS/2 keyloggers.
To answer that question for myself I recently bought an USB keylogger for experimenting. While there are surely different devices on the market and not all work in the same way, the one I bought (KeeLog USB Keygrabber) seems to be a tough nut to detect.
Using Software
What I tried so far (under Linux):
lsusb
and lsusb -t
lshw
powertop
tail -f /var/log/syslog
None of these commands showed any difference depending on whether the keylogger was in use or not. No additional device is showing up, no strange error messages in the log, no different bus addresses for the same device, etc.
So the keylogger I bought does not behave like a USB hub or such, it just seems to pass through (and capture) every packet on the bus.
But since the keylogger has to be inserted between the computer and the keyboard, you might consider any USB keyboard unplug events as suspicious. I though expect quite some false positives.
The only way I could see a difference so far was with additional hardware:
Measuring Power Consumption
I used the USB Charger Doctor from Adafruit between my computer and the keylogger and it showed 0.04 A more than without the keylogger. But so far I was not able to see this difference in power consumption with software, i.e. with powertop
.
But this kind of detection has several drawbacks:
Hitting Caps-Lock and/or Num-Lock on the keyboard also caused additional power consumption from its LED and that was in about the same range according to the USB Charger Doctor: 1 LED = 0.03 A, 2 LED = 0.05 A.
If I have to check the USB Charger Doctor everytime before I use a PC, I very likely will also detect an USB keylogger sitting at the same place or nearby.
Using Additional Devices On The Same USB Port
If you look for keylogger at e.g. Amazon, you'll notice that some won't work if there's an USB hub in the keyboard (and others claim that their product does). So I put a simple USB hub behind the keylogger and plugged the keyboard into the USB hub (i.e. Computer → Keylogger → USB Hub → Keyboard).
Result was that — at least with the keylogger model I bought — neither the USB hub nor the keyboard were detected by my computer anymore, no traces in the logs as usual when I plug in an USB device. The power LED on the USB hub was on though.
So one way to mitigate (and nothing more) the danger of not detecing an USB hardware keylogger is to use an USB extension cable from the back of your PC ending on a visible place on your desktop, plugging in an USB hub there and the keyboard into the hub. If then suddenly the keyboard stops working, you will likely check the whole USB chain and might notice a keylogger that way.
So my personal recommendation is:
Make Sure You Can Check Your Keyboard Connector Easily
Set up your desk and PC in a way that the connector of your keyboard is always or at least often enough visible:
Plugin the keyboard into a frontside USB socket if your PC is sitting on your desktop. Currently keyloggers are still big enough to be noticed that way.
If you don't need any of the frontside stuff of your PC (e.g. CD ROM drive) and don't mind its ugly backside, turn your PC around so that you can see all backside connectors while working.
If you have enough space around your desk and your PC is a tower case sitting under your desk, set it up in a way that you pass the PC's back of your desk regularly and have a look at the back of your PC e.g. every morning when you arrive at work or so.
Further Discussion
This topic has also been covered over at StackExchange's IT Security site in the question "Detecting Hardware keyloggers… elegant solutions?".