| 1 |
=========================================================================== |
| 2 |
GARMINTOOLS |
| 3 |
=========================================================================== |
| 4 |
|
| 5 |
This software provides Linux users with the ability to communicate |
| 6 |
with the Garmin Forerunner 205 and Forerunner 305 via the USB |
| 7 |
interface. While this is the only Garmin unit that I own, I did |
| 8 |
implement all of the documented Garmin protocols |
| 9 |
(http://www.garmin.com/support/pdf/IOSDK.zip) as of Rev C (May 19, |
| 10 |
2006) over the USB physical link. This means that if you have a |
| 11 |
Garmin with a USB connection to a PC, you ought to be able to use this |
| 12 |
software to communicate with it. |
| 13 |
|
| 14 |
==> You will need to make sure that the 'garmin_gps' kernel module is |
| 15 |
not loaded or compiled into your kernel. This module conflicts |
| 16 |
with the garmintools software. |
| 17 |
|
| 18 |
If you're looking for a complete solution to all of your Linux Garmin |
| 19 |
GPS needs, this is not it. I own a Garmin Forerunner 305 and wrote |
| 20 |
this code specifically so I could download and save data from that |
| 21 |
particular GPS unit to my Linux machine. I tried gpsbabel |
| 22 |
(http://www.gpsbabel.org), but found that it did not have command line |
| 23 |
options specific to the Forerunner run and lap data - all I could do |
| 24 |
was get the tracklog. That's how all of this got started. I also |
| 25 |
wanted a few other things, like the ability to convert a track log |
| 26 |
into a Google maps encoded polyline, and (eventually) the ability to |
| 27 |
generate PNG images of heart rate and elevation data. |
| 28 |
|
| 29 |
You need to have the libusb library (http://libusb.sf.net) installed. |
| 30 |
You must also have read and write permissions to the device file |
| 31 |
through which the Garmin unit is accessed. The easiest thing to do is |
| 32 |
run the programs as root. Alternatively, you can write a hotplug |
| 33 |
script. I haven't tried this yet. |
| 34 |
|
| 35 |
As of version 0.01, this software gives you the ability to do the |
| 36 |
following: |
| 37 |
|
| 38 |
1) Get basic information from the Garmin unit, such as its software |
| 39 |
version and supported protocols. To do this, use |
| 40 |
'garmin_get_info'. |
| 41 |
|
| 42 |
2) Save runs and associated track logs from the Garmin unit to disk. |
| 43 |
To do this, use 'garmin_save_runs'. Files are saved with the |
| 44 |
extension ".gmn" and are named by the run start time |
| 45 |
(e.g. '20070121T151814.gmn'). The .gmn file format is a binary |
| 46 |
file format that can be unpacked with the same functions that |
| 47 |
unpack the raw data from the Garmin unit itself. It is |
| 48 |
substantially more efficient than the bloated XML format that |
| 49 |
Garmin uses. |
| 50 |
|
| 51 |
IMPORTANT NOTE: The output of garmin_save_runs will tell you where |
| 52 |
on your filesystem the actual .gmn files were saved. The default |
| 53 |
is to save them in a directory tree (by year and month) under the |
| 54 |
current directory. You can override this by setting the |
| 55 |
environment variable GARMIN_SAVE_RUNS to whatever directory you |
| 56 |
like. |
| 57 |
|
| 58 |
ANOTHER IMPORTANT NOTE: Old workouts are not deleted from the |
| 59 |
watch, and their laps hang around for a long time. This once led |
| 60 |
me to clobber half a dozen saved runs with truncated files |
| 61 |
containing only the lap data (because the associated track logs had |
| 62 |
long since been overwritten in the Forerunner's memory). |
| 63 |
Therefore, if a file with the same name already exists, it is *not* |
| 64 |
overwritten. |
| 65 |
|
| 66 |
FINAL NOTE: As a result of that rather unpleasant experience, I |
| 67 |
wrote a Perl script 'fore2gmn.pl' (included in the 'extras' |
| 68 |
directory) that can convert a .hst file (the XML format exported |
| 69 |
from Garmin Training Center) to a set of .gmn files. These .gmn |
| 70 |
files are saved in the current working directory without any of the |
| 71 |
year/month hierarchy business. Using this script, I was able to |
| 72 |
restore the six files that I had lost. |
| 73 |
|
| 74 |
3) Dump the contents of a .gmn file. To do this, use 'garmin_dump'. |
| 75 |
The output of garmin_dump is XML-like, and is mainly meant to be |
| 76 |
used for debugging. |
| 77 |
|
| 78 |
4) Print, in an XML-like format, the encoded polyline representation |
| 79 |
of a .gmn file (for Google maps) along with other information such |
| 80 |
as the start and center latitude/longitude, and the lat/lon |
| 81 |
bounding box. To do this, use 'garmin_gmap' on a .gmn file. |
| 82 |
|
| 83 |
In addition, the garmintools API in src/garmin.h gives you the ability |
| 84 |
to read a .gmn file and do pretty much anything you want to it. |
| 85 |
|
| 86 |
I chose to write this software in C. C++ programmers (and I am one of |
| 87 |
them) might have a look at the code and ask, "Why not do this in C++ |
| 88 |
and spare yourself all of the switch statements?" I don't have a good |
| 89 |
answer, just a bunch of half-answers, and I may end up changing my |
| 90 |
mind. The bottom line is that even after years of C++ programming, I |
| 91 |
still like to stick with C when I can. If you've ever had to deal |
| 92 |
with aCC on HP-UX, you understand. |
| 93 |
|
| 94 |
CAVEAT: I have only tested this software with the Forerunner 305 that |
| 95 |
I own. Users have reported that it also works with the Forerunner |
| 96 |
205. I don't know if it works with the Edge 205/305, the Forerunner |
| 97 |
405, or any of the more recent Edge models. |
| 98 |
|
| 99 |
ONE MORE CAVEAT: The 'garmin_gmap' utility expects a .gmn file with a |
| 100 |
D304 track point data type. This is the data type used by the |
| 101 |
Forerunner 305. I WILL FIX THIS SOON. Also, the output of |
| 102 |
garmin_gmap is not for the faint of heart. You will need to have your |
| 103 |
own website where you can put this encoded polyline in an HTML file, |
| 104 |
following the instructions on the Google maps API reference pages: |
| 105 |
|
| 106 |
http://www.google.com/apis/maps/documentation/ |
| 107 |
|
| 108 |
I may make this easier some day. For now, this is how it is. |
| 109 |
|
| 110 |
Dave Bailey |
| 111 |
Truckee, CA |
| 112 |
22 February 2007 |
| 113 |
|