Using E-TREX with Linux

Introduction

A few years ago I bought a Garmin eTrex Legend HCx. This article records my experiences with the device including terminology, procedures and Linux compatibility.

Terminology

  • GPS coordinate: representation of a geographical location in numeric format, specified as degrees north of the equator and east of the Greenwich meridian (e.g. N40.829656,E-73.926198)
  • GPS receiver or just GPS: the equipment (e.g. Garmin eTrex Legend HCx) for receiving GPS data (e.g. the device’s current GPS coordinates, its current altitude)
  • point of interest or POI: a geographical location which is of general interest (e.g. the Kempinski Hotel Munich, the police station on the Boulevard du Palais on the Ile de la Cite, the Natural History Museum in London, the Volpetti Rosa pizzeria in Rome)
  • waypoint: a geographical location which is on a route; this is normally a POI or a more personal point of interest (e.g. corner of School Street and Province Street in Boston, your friend’s house, the peak of Mount Everest, N52.524183,E13.412437)
  • map: data about a region; it includes locations of roads, altitude information, POIs
  • basemap: a basic map that comes preloaded on the receiver; it is not deletable; the lack of detail on the map means it is pretty useless unless you’re making a long intercity journey (see here)
  • Americas, Atlantic or Pacific Recreational: Garmin’s base maps
  • OpenStreetMap or OSM: a free worldwide map, “created by people like you”
  • route: a manually or automatically calculated set of instructions for getting from somewhere to somewhere created before a journey
  • manually calculated route: a route where the set of instructions is defined by a person. Typically, this involves creating a sequence of waypoints (perhaps at road junctions) or downloading from the internet a track that somebody else has traveled and using software to convert it to a route
  • automatically calculated route: a route where the set of instructions is defined by a computer (e.g. MapSource, Google Maps, your GPS). Typically this involves requesting the computer to calculate a route from the start waypoint to the end waypoint (e.g. from Paris, possibly via Zurich to Prague or from home, possibly via the dentist’s surgery, to work)
  • track: location data created during a journey (e.g. now, at 4pm the device is at N52.52344,E13.411399 and now, at 4pm and 10 seconds it is at N52.523788,E13.4119 and now at 4pm and 20 seconds it is at N52.524183,E13.412437, etc).
  • navigation mode: the method by which the route between the waypoint on a route are calculated; note that even in a manually calculated route navigation mode is still relevant
  • off-road navigation mode: straight lines are drawn between the waypoints on a route on the map; it is assumed this is enough for your purpose (e.g. you might specify enough waypoints so as not to need more than straight lines
  • follow-road navigation mode: the GPS will calculate the route between waypoints using roads; if no roads are available then it will tell you to turn back so that it might approach the next waypoint from another direction
  • GPS navigation software: software for browsing maps, preparing routes, transferring maps, routes, waypoints to and from the GPS
  • MapSource: Garmin’s GPS navigation software
  • Trip & Waypoint Manager: MapSource and one of Garmin’s base maps bundled together on CD and distributed with the GPS
  • Navit, QLandkarte GT, …: open source GPS navigation software

Procedure: Firmware upgrade

  1. Insert the SD card
  2. Put the device into “USB storage” mode (System->Interface->USB storage)
  3. Attach the device to a Linux box and check of the GPS is seen as a new drive of the correct size.
  4. If it is then the firmware does not need to be upgraded.
  5. Attach the device to a real Windows system (not Wine)
  6. Perform a firmware upgrade.

Procedure: Granting access to the hardware

  1. Attach the device and run:
    lsusb | grep -i garmin

    and note the vendor and product IDs (these are the four digit numbers on either side of the colon, respectively). In what follows, we’ll assume those IDs are ’091e’ and ’0003′, respectively.

  2. Edit /etc/modprobe.d/blacklist.conf and if the following line is not already present then add it:
    blacklist garmin_gps
  3. Edit /etc/udev/rules.d/51-garmin.rules to contain the following:
    SYSFS{idVendor}=="091e", SYSFS{idProduct}=="0003", GROUP:="plugdev", MODE:="660"
  4. If you are not already in the ‘plugdev’ group, then edit /etc/group and add youself to it.
  5. Reboot (or log out and in again to have your login processes added to the supplementary groups and run:
    udevadm control --reload-rules

    but honestly, it’s easier just to reboot.)

Procedure: Installing MapSource

  1. Insert “Trip & Waypoint Manager” CD-ROM or mount its ISO image.
  2. Attach the GPS and put it in USB storage mode; wait until Linux has automatically mounted the device and you can browse it in a file browser.
  3. Run:
    winecfg

    and set:

    1. the Windows version to ‘Windows XP’
    2. the drive type to ‘floppy’ (failure to do this will result in the Wine seeing the drive, but MapSource software not seeing it when run on newer versions of Wine!) as illustrated here:
      winecfg-gps-drive
  4. Run:
    cd <mountpoint-of-cd-or-iso-image>
    wine Setup
  5. At the “Trip & Waypoint Manager” window, click “Install Trip & Waypoint Manager”. If the following error message appears:
    err:msi:copy_package_to_temp failed to copy package L"TWPT_ENU.msi"
    fixme:msi:MSI_OpenDatabaseW open failed r = 80030002 for L"TWPT_ENU.msi"

    or

    wine: cannot find L"D:\\Setup.exe"

    then just exit and rerun:

    wine Setup
  6. At the “Trip and Waypoint Manager v4 Setup” window, when prompted “Welcome …”, click “Next”.
  7. At the “Trip and Waypoint Manager v4 License Agreement” window, when prompted “SOFTWARE LICENSE AGREEMENT”, tick the “I accept the Software License Agreenent” checkbox, and click “Next”.
  8. At the “Trip and Waypoint Manager v4 Setup” window, when prompted “Installing to the default location …”, set the installation directory to C:\Garmin (under Debian squeeze I found that drive C: could not be seen despite it having been correctly set up by winecfg earlier and I had to set the installation directory to it explicitly … twice!) (Failure to set it to C:\Garmin will cause a lot of registry-based problems later) and click “Install”.
  9. At the “Trip and Waypoint Manager v4 Setup” window, when prompted “Garmin Trip and Waypoint Manager v4 is successfully installed …”, click “Finish”.
  10. At the “Trip & Waypoint Manager” window, when prompted “… Get Adobe Reader …”, move cursor back into the terminal window from where you launched wine and press CTRL-C.
  11. Under Debian squeeze, I found that the MapSource software was installed in ~/Garmin (which Wine called H:\Garmin) and the Trip and Waypoint Manager software (i.e. the basemap) was installed in ~/.wine/drive_c/Garmin (which Wine called C:\Garmin), despite the fact that I specified everything to be installed in C:\Garmin. To correct this I ran:
    mv ~/Garmin/* ~/.wine/drive_c/Garmin
    rmdir ~/Garmin

    (MapSource.exe seemed to be able to find all its other components without problems after this move.)

  12. If you want to set up your window manager’s or panel’s menus to run MapSource then the command to run is:
    sh -c 'wine ~/.wine/drive_c/Garmin/MapSource'

    and here is a little icon to use: mapsource-logo

Procedure: Installing maps from the OpenStreetMap project

  1. Different maps need to be installed in different ways.
  2. Regedit may be needed to load .reg files.
  3. If regedit refuses to load a .reg file by running:
    regedit <filename>

    then it may be necessary to change the first line of .reg files from:

    ��Windows Registry Editor Version 5.00

    to

    REGEDIT4

    or to convert from Unicode to ASCII by cat-ing the file and then using the mouse to copy it and paste it into a new file or by running:

    iconv -f UNICODE -t ANSI_X3.4 <old-reg-file> -o <new-reg-file>
  4. Unlock the maps from within MapSource.

Procedure: Pushing maps to the GPS

This procedure covers selecting which maps should go on the GPS, merging those maps into one file, transferring them to the GPS. It does not cover transferring waypoints, routes and tracks.

  1. Power on the GPS, connect it to the computer, and put the GPS in “USB storage” mode.
  2. Make sure the device is now mounted and browsable with your file browser.
  3. Run MapSource.
  4. Select the map tool (either from the ‘Tools’ menu or from the toolbar).
  5. Switch to a product (either from the ‘View’ menu or from the toolbar).
  6. Use the mouse to select from the grid of maps those maps you wish to download to the GPS.
  7. Repeat the last two steps for other products (e.g. to select south-east England and London).
  8. From MapSource’s ‘Transfer’ menu, select ‘Send to device …’; the device should be listed (e.g. as D:\); click ‘Send’; if it is not listed then run:
    winecfg

    and make sure that the drive type is set to ‘floppy’.

  9. Wait. (The merging of maps and the subsequent download are quite slow; the fewer map segments you select the faster it will be.)

Procedure: Pushing waypoints and routes to the GPS

  1. Power on the GPS, connect it to to the computer, make sure it is not in “USB storage” mode (and therefore not mounted).
  2. Run:
    gpsbabel -r \
        -i gpx -f <gpx-file-containing-routes>.gpx \
        -o garmin -F usb:
    gpsbabel -w \
        -i gpx -f <gpx-file-containing-waypoints>.gpx \
        -o garmin -F usb:
  3. If this does not work then repeat as root.

Procedure: Pulling tracks from the GPS

  1. On the GPS, save any tracks (ideally, do this on the same day you made the track, then it will be named after that date).
  2. Put the GPS in USB mass storage mode, mount the device and copy over the GPX files (don’t use gpsbabel to retrieve the tracks as, for some reason, the track will only contain 500 track points) and then unmount the device.
  3. Load each file into MapSource and delete any 1- or 2-point tracks (such as are created if the GPS starts recording tracks before it has acquired satellites).
  4. If any of the tracks have odd points in them (such as are created if the GPS starts recording tracks before it has acquired satellites) then right-click on the track, select ‘Properties’ and try to work out which point needs deleting, and then edit the GPX file and reload it).
  5. Run the command:
    GLOB="2*.gpx"
    eval gpsbabel \
        -i gpx $(for X in $GLOB; do echo -f $X; done) \
        -x track,merge \
        -o gpx -F mergedfile.gpx
  6. Some sites restrict the size of GPX uploads so it may be necessary to run something like this:
    gpsbabel \
        -i gpx -f mergedfile.gpx \
        -x simplify,count=2000 \
        -o gpx -F simplifiedfile.gpx
  7. If you merge tracks or perform other operations using gpsbabel and try to load the resulting files into MapSource then you may encounter:gpsbabel-data-in-mapsource-errorthen run:
    perl -0777 -pi -e 's@(?<=<trkseg>\n)<extensions>.*?</extensions>\n@@ms' \
        file-1.gpx file-2.gpx ...

    which will delete any <extensions> sections which are inside any <trkseg> sections. There is no need to delete <extensions> sections which are inside <trk> sections but not inside deeper <trkseg> sections.

  8. Uploading that to GORP results in images like this:
    gorp-track
    so be sure to use the track viewer, not the route viewer.

What they didn’t tell you

  • You definitely need more maps! Note that country maps don’t include cities; city maps are a bundled as a separate product! E.g. I needed to install the following products:
    1. Topo Deutschland
    2. City Navigator Europe NT 2008
  • The maps are expensive! Check out their prices on Amazon or wherever.
  • if you are only using the basic “Trip & Waypoint Manager” map and you are doing on-road routing, then a route from your house to the corner shop will go via the autobahn!
  • Any off-road routing will go “as the crow flies” – in an absolutely straight line.
  • Since on-road and off-road routing can be useful (straight lines are useful for manually calculated routes over fields and small tracks, but obviously not when you’re going from Paris to Prague), it is possible to set the default routing method to ‘prompted’, meaning that whenever you follow a track or a route or go to a waypoint, then you’ll be asked to specify if it should be on-road or off-road. I keep mine on this setting because I use both routing methods about equally.
  • If you want to navigate somewhere and you have no satellite reception you’ll get no instructions because the GPS doesn’t know where you are; if it doesn’t know where you are then it can’t possibly begin to work out how to get to your destination.
  • When looking at the map, a quick press of the joystick creates a waypoint where the cursor is, but a long press of the joystick creates a waypoint where the GPS/you is/are.
  • If you move the cursor on top of a waypoint in order to get it automatically selected and click then you’ll be brought into the waypoint menu (delete, show on map, navigate to). If you choose ‘map’ to show it on the map things look just as they did before, but now if you get the same waypoint automatically selected and click then you’ll be able to move it (correct its position I mean)
  • There are two sorts of compasses: magnetic compasses and GPS compasses; not all models have magnetic compasses. GPS compasses can only tell which way is north when you are moving. This means if you are standing still then north will probably wander around and you should not rely on it.
  • When playing games the cursor is moved by you moving with the GPS, not by moving the joystick
  • Remember to enable track logging before starting a journey. If you do so and then later you don’t want the track you can delete it. If you don’t do so and later you do want the track you’re screwed.
  • Routes in MapSource can contain as many points as you like. Routes in the GPS are limited to 250 points.
  • If you buy a mounting clip to put your GPS on your bicycle, then watch out: there is a package which includes the clip and a replacement back-panel for the GPS, but this back panel does not fit on the GPS models which have a slot for an micro SD card. If in doubt, take your GPS to the shop and and actually try it before you leave!

Review

Overall, I am extremely happy with this device and would recommend it to any cyclist, mountain hiker or city walker.

It does everything I need (I want to plan on- and off-road routes for cycling, off-road routes for hiking, get GPX data for my tracks, and use it when I get lost in a foreign city), it works reasonably well with Linux using Wine and gpsbabel, the display is bright and easy to read, a couple of its screens can be configured to display the information you prefer (e.g. on one screen I have a large compass/heading-arrow and current time and on another display I have time to next waypoint, distance to next waypoint, time to destination, distance to destination, current time, current speed, …).

One bad point is that, if this is to be your first GPS, then the documentation is woefully inadequate!

One feature i miss, and I suspect this is something not available on any GPS, is a panel indicating the heading after the next way point; I can see what heading I should be on up until the next route point, but I cannot see what my heading should be after that. Yes, I can look at the map screen but, generally I’m looking at the configurable screens (to see speed, distance covered, current time, etc).

Andy Allan wrote a good review.

See also

m4s0n501