Added --list-devices (-l) --match-devices (-m) to ease device selection.
List-devices lists available evdev devices in format "<path>: <vendor>,<product>,<version>,<name>". For example on this desktop:
/dev/input/event0: 1,1,ab41,AT Translated Set 2 keyboard
/dev/input/event1: 46d,c051,110,Logitech USB-PS/2 Optical Mouse
/dev/input/event2: 0,1,0,Power Button
/dev/input/event3: 0,1,0,Power Button
/dev/input/event5: 1f,1,100,PC Speaker
/dev/input/event6: 0,0,0,Eee PC WMI hotkeys
/dev/input/event4: 0,0,0,HDA Intel PCH Front Mic
/dev/input/event7: 0,0,0,HDA Intel PCH Rear Mic
/dev/input/event8: 0,0,0,HDA Intel PCH Line
/dev/input/event9: 0,0,0,HDA Intel PCH Line Out Front
/dev/input/event10: 0,0,0,HDA Intel PCH Line Out Surround
/dev/input/event11: 0,0,0,HDA Intel PCH Line Out CLFE
/dev/input/event12: 0,0,0,HDA Intel PCH Line Out Side
/dev/input/event13: 0,0,0,HDA Intel PCH Front Headphone
/dev/input/event14: 0,0,0,HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event15: 0,0,0,HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event16: 46d,8d7,100,gspca_zc3xx
/dev/input/event17: 0,0,0,HDA ATI HDMI HDMI/DP,pcm=3
/dev/input/event18: 0,0,0,HDA ATI HDMI HDMI/DP,pcm=7
/dev/input/event19: 0,0,0,HDA ATI HDMI HDMI/DP,pcm=8
/dev/input/event20: 0,0,0,HDA ATI HDMI HDMI/DP,pcm=9
/dev/input/event21: 0,0,0,HDA ATI HDMI HDMI/DP,pcm=10
/dev/input/event22: 0,0,0,HDA ATI HDMI HDMI/DP,pcm=11
/dev/input/event23: 0,6,0,Video Bus
Match-devices takes a string parameter that contains a regular expression to match device strings to. A device string is "<vendor>,<product>,<version>,<name>", so devices can be matched based on the numeric ids or name. Multiple match-devices instances can be provided. For example
./funkeymonkey -m "[Kk]eyboard" -m "[Mm]ouse" -p libkeyboard.so
would match both event0 and event1 here. "^0,6,0" would only match event23.
Because that's pretty much all identifying information evdev provides, I'm not sure how this could be made more precise and/or flexible. Any ideas are welcome