Thursday, April 24, 2008

Delorme Earthmate LT-40 and Linux

I just got the new Delorme Earthmate LT-40. It works pretty well, getting a location lock under windows much more quickly the old version I had (Earthmate USB predating the LT-20). I think it took ~ 5minutes from a completely cold start to get a differential GPS lock. I also noticed last night that it managed to get a 3D lock while I was sitting in my living room. Very impressive, as I only had it plugged in to test that I could actually see it, I didn't actually expect it to work. :)

However, it did not work for me under Linux using the 2.6.24 kernel. I plugged it in, it was recognized by the cypress_m8 usb-to-serial driver and the /dev/ttyUSB0 device was created. However, trying to cat this device resulted in no output. A bit of googling showed these threads relating to the Earthmate LT-20:

http://ubuntuforums.org/archive/index.php/t-220821.html
http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg52237.html

A few posts to the linux-usb list and I was directed to this patch series:

Cypress_m8 Patch 1: Feature Buffer Fixes
Cypress_m8 Patch 2: Packet Format
Cypress_m8 Patch 3: Get Config Unsafe for LT-20
Cypress_m8 Patch 4: Null Check
Cypress_m8 Patch 5: Limit Baud Rate to <= 4800

Patch #3 is the important one here, but needs the first 2 to be applied easily. I've assembled them together into easily used diffs here. Those looking for a quick fix should simply comment out the call to
cypress_set_dead(port);
at line 408 (at least it is for 2.6.24) of the file drivers/usb/serial/cypress_m8.c.

Thanks go Mike Isely for writing the patches and directing me to them. This series of patches is slated to go into 2.6.26.

So for anyone looking to use their new Earthmate LT-40 (or even LT-20) under Linux, there is hope.