Homepagina van Peter Verthez

Using a Garmin GPS and MapSource with Linux

The problem

Garmin is a popular brand of GPS devices for people who are using their GPS for cycling and walking. Unfortunately, Garmin only makes its MapSource application for the Windows operating system.

A useful tool under Linux is gpsbabel, but it does not give you a possibility to use the maps that are delivered with or can be purchased for a Garmin GPS unit.

The ideal would of course be that Garmin would start to think cross-platform, and there are always hints dropped that this will some day be the case, e.g. this page. What most people don't realize however is that wine, the program that allows to run Windows binaries on Linux, is currently already in a state that it runs MapSource very well, at least for Garmin units that communicate via USB.

This page describes what I had to do to get it working...

Installing MapSource using wine

For the record, the following installation is based on:

  • Fedora 8
  • the current wine package (wine-0.9.56-1.fc8)
  • a Garmin Vista CX, with the standard USB cable

I assume that different Linux distributions, and different GPS units using USB would work equally well, but I haven't tested this. Note that I use the current wine package as reference here, but I had this already working last summer, using Fedora 6 and the wine package that was current then...

Warning: the Fedora 10 kernel disables the Garmin GPS driver. This was tracked by this bug report. If you need to use your Garmin GPS unit on Fedora 10, there are some tips given in that bug report for how to build the module yourself. From Fedora 11 onwards it is enabled again.

I installed the following official maps from Garmin:

  • City Navigator NT (Europe) version 9
  • Topographic map of Belgium
  • Route planner for cycling and walking in Belgium

I skipped the map that is delivered with the GPS unit itself (Trip and Waypoint Manager), because it is only a very basic map. But that one should also work.

Update: on later Fedora releases (e.g. Fedora 14) you should make sure that you disable the gpsd service, because that interferes with the use of the GPS device via the serial port.

This is done by disabling the service in the "System/Administration/Services" GUI, but you should also remove the /etc/udev/rules.d/99-gpsd.rules file, so that gpsd is not invoked automatically by udev when the GPS device is connected. Afterwards, reboot to make sure that those rules are gone from udev.

GPS device setup

First make sure that you can access the GPS device from Linux. This is unrelated to wine: it is equally necessary to use the GPS with e.g. the gpsbabel tool. On Fedora 8, the device /dev/ttyUSB0 is used, as found from /var/log/messages.

This device is managed via the garmin-gps kernel module, which is automatically loaded on Fedora 8 when attaching the device. On other distributions, check that this kernel module (which is part of the stock kernel nowadays) is loaded when you attach your gps, and if not, execute as root the following and try again (thanks to Brian Cluff to bring this to my attention):

modprobe garmin-gps

You can add this statement e.g. to /etc/modules or /etc/modprobe.conf or whatever file your distribution uses, so that it is taken automatically into account on the next reboot.

Next, you have to examine the permissions of the device after attaching the device (/dev/ttyUSB0 in my case). I get the following:

$ ls -l /dev/ttyUSB0 crw-rw---- 1 root uucp 188, 0 2008-05-12 10:13 /dev/ttyUSB0

which means I have to add myself into the 'uucp' group (in Fedora 14, it is the 'dialout' group). The easiest way to do this is via the menu "System/Administration/Users and Groups", select your user and check 'uucp' in the Groups tab. It is advised to log out and log back in after that, so that you have the new group active.

You can also create a specific link for your GPS device via a udev rule (thanks to Patrick C.F. Ernzer to point that out). Create a file in "/etc/udev/rules.d/" (this is the location in Fedora 8), containing the following, all on one line:

BUS=="usb", SYSFS{idProduct}=="0003", SYSFS{idVendor}=="091e", KERNEL=="ttyUSB*", SYMLINK+="garmin"

This creates a new device "/dev/garmin" that is a link to the ttyUSB device of the GPS.

See "/usr/share/doc/udev*/writing_udev_rules/index.html" (again, this is the location in Fedora 8) for how to determine your idVendor and idProduct using udevinfo.

Wine installation and configuration

Then make sure that wine is installed. I installed it from the Fedora repository, which means you have to do nothing more than 'yum install wine' (wine is a meta-package in Fedora; it will install the necessary constituents automatically).

To get the GPS communication working under wine, the device should be defined in wine. This is simply done as follows:

ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com2

This will define the /dev/ttyUSB0 device as COM2 under Windows.

If you have created the udev rule as mentioned above, you can use /dev/garmin instead of /dev/ttyUSB0, which is useful if there are multiple ttyUSB devices and the trailing number would not be predictable.

Installing MapSource

We'll start with the City Navigator NT (Europe) map, which gives a complete coverage for Europe, primarily directed at car navigation. Mount the CD and then go to the directory under which it is mounted (for me this was "/media/CNEURNTV9").

cd /media/CNEURNTV9 wine ./Setup.exe

This should install the program normally (you may get some warnings in the terminal, but just ignore these). Choose the default location to install the program in. At the end, don't opt to start up the program directly (the program hung when I did this). Instead, start the program via the command line:

wine ~/.wine/drive_c/Garmin/MapSource.exe

You should now see the program starting normally. You will have to unlock the map that you have installed, in the same way as you would do under Windows, but after that play with the program to see whether it functions correctly. For me all functions are working, including GPS communication and software updates.

In the same way, the other maps can be installed. For one of my maps (the topographic map), I got the following warning on my terminal:

err:module:import_dll Library MSVBVM60.DLL (which is needed by L"D:\\setup_dutch\\Setup.exe") not found

The program apparently needed the Visual Basic library, and after some searching on Google, I found I could download it from this location and copy it to "~/.wine/drive_c/windows/system32". This allowed the installation of that map.

Some final word of advice: using the UnlockWizard (Utilities/Unlock Maps... in the program), select "Backup my unlock codes to a file" to save all the unlock codes, and keep a backup of that file. If you then ever need to uninstall/install MapSource or your entire computer, you don't have to go through the lengthy process of getting the unlock codes again: you can "Retrieve and reinstall all my Garmin unlock codes" using the UnlockWizard...

Have fun!