Garmin is the Apple iPod of GPS products. So when it came time to purchase a new GPS, I grabbed a Garmin eTrex Vista HCx. It had a great feature set for a handheld unit: SD card expansion, turn-by-turn directions, etc. And because it’s a Garmin, it had the best “hacker” support, namely: free maps from Open Street Maps.
The one thing that I was dissatisfied with was the software support under Linux. Sure you could plug it in, and retrieve data, but simple editing of tracks (splitting, joining) was tedious. Garmin’s free MapSource software worked well, but I wanted to avoid booting into Windows just to use it. Luckily I found this thread on ubuntuforums.org. I rehash here much of the info provided there, and include some updates.
An Aside about Strava
I use my GPS mostly while cycling. A while back a friend tipped me off to a site called Strava where you can track your rides and compete virtually with others.
I’m not a competitive cyclist. I ride more to shuttle kids to the library, or for picking up groceries. But I do like to use my GPS while riding and upload the data to Strava to track my miles, calories burned, etc. It’s also fun to see what sort of excruciating rides competitive cyclists are doing.
My beef with Strava is that they just recently shut down the version 1 & 2 API access to their site. They are launching a new V3 API, but your application must be approved to use the service. Unless a new version to any API is fully available, it’s customary to leave the old version(s) of the API accessible for a period of time so developers can update their software. Unless the old API is causing undue stress on server hardware and equipment, there should be no reason that an old API is turned off before the new one is available.
My guess is that they (like Twitter) want to control who can/can’t use their API. It could also be a stupid knee-jerk reaction, like I’ve seen many governments and businesses make. Recently there was a lawsuit brought against Strava. They may now want to control the exact wording of the competitive elements of the apps so Strava users aren’t feeling coerced into regaining their top time by riding dangerously. It all feels like a digital nanny-state to me. My guess is that no open-source projects will be able to use the V3 API because there’s probably some DRM key (or equivalent) required to connect.
Nevermind that I’m a contributor to the Strava plugin for WordPress (which no longer works thanks to Strava). WordPress only powers a billion websites and has the largest market share of any web publishing platform. Isn’t the point of having an API to promote the widest adoption possible?!? If Strava doesn’t change, maybe I can convince tons of WordPress cyclists to switch to Garmin Connect – they don’t seem to be ostracizing developers.
Back to installing MapSource…
The first order of business is installing Wine:
sudo apt-get install wine
winecfg (as your normal user). This will create a
Just click OK when the dialog appears.
In order to install the latest MapSource, you actually have to install an older version of the software first because MapSource checks for the presence of an earlier version during installation. Fooling the earlier versions to the presence of MapSource is actually quite easy:
cd ~/.wine/drive_c mkdir Garmin touch Garmin/MapSource.exe
Get an older version, like
MapSource_6153.exe from http://gawisp.com/perry/mapsource/
Then run the installer:
Follow the on screen instructions. Accept the license and it will install. At the end of the install you can launch MapSource – don’t do this! Uncheck the check mark and just exit the installation.
Once you’ve installed MapSource the simple way, you can then update to a newer version of MapSource which looks for a “proper” MapSource installation. There may be some sort of secret sauce to having your upgraded MapSource fully functional. I initially had problems with the newest version crashing when saving a GPX file. But then it went away when I did a couple of incremental upgrades. If you have this problem, maybe try removing the latest version through the Wine uninstaller and installing a slightly earlier version. Please comment if you have any insight as to what works and what doesn’t.
Adding a drive
My maps exist on a Windows partition on my computer. Rather than reinstalling the (huge) files in Wine, I added a Wine system drive that linked to my Windows partition.
After mounting the Windows partition (simply by selecting it under devices in the nautilus file manager), I then made a symlink to my
cd ~/.wine/dosdevices ln -s /media/justin/OS "o:"
/media/justin/OS with the correct path to your Windows partition, once it’s mounted in Linux. I chose “O” as my drive letter since I normally mount the disk as “OS” – you can choose whatever drive letter you’d like.
Add registry keys
This is most easily done by exporting registry keys from Windows and importing them into Wine’s registry. Here is a screenshot from my registry from Windows:
In the UbuntuForums post, the author notes that MapSource looks for maps under
HKEY_LOCAL_MACHINE\Software\Garmin\MapSource\Families, where as my installation (Windows 7) had the maps installed under
HKEY_LOCAL_MACHINE\Software\Wow6432Node\Garmin\MapSource\Families. So I exported the keys from Families in my Windows installation and then installed them in the same place in the Wine registry.
After installing the key(s) into the Wine registry, I updated the values and changed any references to
O:\ – my custom Wine device that links to my Windows partition.
Once this is done you can test that your maps are being read correctly.
cd ~/.wine/drive_c/Garmin/ wine ./MapSource.exe
If your maps are installed correctly, they’ll show up under View > Switch to Product. Even if you have no maps installed, MapSource may still be useful to you for downloading tracks from your Garmin and exporting to other formats such as GPX.
Set up a COM device
In order for MapSource to be able to upload/download anything from your GPS, we need to set up a COM device so they can communicate. First load the
garmin_gps kernel module (which strangely didn’t autoload in Ubuntu):
sudo modprobe garmin_gps lsmod | grep garmin
And you should see something like:
garmin_gps 18212 0 usbserial 36911 1 garmin_gps
Turn on the GPS and connect it to the USB port. Then do:
You should see a device called
Now we have to make this device visible as
com1 port under Wine:
cd ~/.wine/dosdevices ln -s /dev/ttyUSB0 com1
When you want to transfer data from your GPS, plug in your Garmin, then run:
sudo modprobe garmin_gps cd ~/.wine/drive_c/Garmin wine ./MapSource.exe
In the Transfer menu, select Receive From Device. You should now see your device and can transfer tracks, waypoints from your GPS into MapSource.