Binary package “evtest” in ubuntu trusty

utility to monitor Linux input device events

 evtest monitors a Linux input device, displaying all the events it
 generates.
 .
 It can be used to determine mice button bindings, keymaps for exotic
 keyboards... It is commonly used to debug issues with input devices
 in X.Org.