mycroes

There's always time to play

Thursday, April 28, 2011

touchmoused: Logitech Touch Mouse server for Linux

Recently I was looking at a way to control the Mac Mini I have connected to my TV. I don't have a keyboard or mouse connected (only a gamepad), but I do have an iPod Touch. Soon I found Logitech Touch Mouse, a simple app providing a keyboard and mouse over the network. Of course Logitech isn't capable of delivering a Linux server for it's app, so I decided to write it myself.

After a quick Wireshark dump I started hacking away. Using the recently released Shairport as a reference I started hacking away on my first Perl program. This also being my first program where I had no documentation on protocol whatsoever, it took me a while to figure out I had to listen both on TCP and UDP. Then it also took me a while before I figured Perl doesn't write directly on a print statement unless autoflush is set on the file descriptor. I managed to find that one on a page detailing serial port communication with Perl.

When these hurdles were overcome I could really start interpreting events, sending them through to the Linux UInput facility. Today another big issue was fixed, mouse movement was broken until I added left mouse button support. So anyone trying to send mouse movements using uinput, be sure to enable left mouse button events!

Anyway, I've now come to a point where the Touch Mouse app can be effectively used as a trackpad replacement. Moving, clicking, (two-finger) scrolling, it all works. Also alphanumeric keys are working, Ctrl and Alt are working and some character keys are working. This also means I think I've come far enough to promote the app here on my blog, so anyone willing to try it out should move on to my github project page.