Garmin ephemeris files and linux

I have two garmin gps watches. A Forerunner 220 and a Fenix. Both can use epehemeris data to speed up satellite fix. It works really well and both watches don’t need more than 15 Seconds to get a fix. Only problem: You need windows to load the ephemeris data onto the watch. So I installed windows, installed the garmin software and started tcpdump. The result is nice. The Garmin software only downloads a file and puts it on the watch. curl can do that also. So here is how to get the gps cache with linux:

curl -H "Garmin-Client-Name: CoreService" -H "Content-Type: application/octet-stream" --data-binary @garmin-postdata http://omt.garmin.com/Rce/ProtobufApi/EphemerisService/GetEphemerisData

On the fr220 the file has to go to GARMIN/REMOTESW/EPO.BIN

On the fenix the file has to be saved to Garmin/GPS/EPO.BIN

I have no idea why one has to post that data. Its only 63bytes. Use mine if you don’t want to start windows.

Update: The cool guys at the the garmin forum found out why the dowloaded File didn’t work. There are always 3 bytes between each chunk of 6-Hour-Data that have to be removed. I wrote some ruby lines to do this. fix_garmin.rb:

#!/usr/bin/ruby
for i in 1..28
$stdin.read(3)
a=$stdin.read(2304)
$stdout.write(a)
end

This script reads from stdin and writes the fixed data to stdout. So you can plug it in the curl command from above:

curl -H "Garmin-Client-Name: CoreService" -H "Content-Type: application/octet-stream" --data-binary @garmin-postdata http://omt.garmin.com/Rce/ProtobufApi/EphemerisService/GetEphemerisData | fix_garmin.rb > EPO.BIN

I am very happy with the setup now. I only have to plug in my watch and the ephemeris data gets downloaded onto my watch automagically. Thanks to udisks-glue. If you only want to have the File and the above seems a bit too complicated, head over to javawas site. He has made a nice online tool. It even supports the garmin-plugin.

This content is licensed under a Creative Commons Attribution 3.0 License.