How to identify a touch screen (or mouse?) protocol with gpm

Install gpm (e.g. aptitude install gpm for Debian, Ubuntu, etc.) and run the following as root (you can sudo bash first)

( for i in `gpm -t types`; do sudo gpm -m /dev/input/whatever -t $i -T -D; done ) 2>&1 | tee /tmp/gpm.log

(where "whatever" is the device you're trying to identify.) Now press the left button or the touch screen repeatedly. Some drivers will spit out a lot of this:

*** debug [daemon/old_main.c(156)]: selected 0 times
*** debug [daemon/old_main.c(156)]: selected 0 times
*** debug [daemon/old_main.c(156)]: selected 0 times

...then...

*** debug [daemon/old_main.c(156)]: selected 1 times
*** debug [daemon/gpm_exited.c(30)]: Removing files /var/run/gpm.pid and /dev/gpmctl

And on to the next driver. Eventually you will see something more like this:

*** debug [daemon/old_main.c(156)]: selected 0 times
*** debug [daemon/old_main.c(156)]: selected 1 times
*** debug [daemon/getmousedata.c(89)]: Data c6 42 63 (50)
*** debug [daemon/old_main.c(156)]: selected 1 times
*** debug [daemon/getmousedata.c(89)]: Data c6 42 63 (50)
*** debug [daemon/old_main.c(156)]: selected 1 times
*** debug [daemon/getmousedata.c(89)]: Data c6 42 63 (50)
*** debug [daemon/old_main.c(156)]: selected 0 times
*** debug [daemon/old_main.c(156)]: selected 0 times

Now you need to hit control-C a couple of times to break the loop. Now run uniq < /tmp/gpm.log > /tmp/gpm.log.uniq before you try to make sense of the output, or just go to the bottom of the file and search backwards for "initialize". Or, you could grep the log for "initialize" and look at the last line. In my case:

# grep initialize /tmp/gpm.log | tail -n 1
*** debug [daemon/init_mice.c(39)]: initialize /dev/input/by-id/usb-SLT_Digital_USB_TouchController-event-if00 with proto evdev

Now I know which protocol is spoken by my touch overlay.