Hotplug vs. Garmin USB on Linux

There are two common hazards with Garmin USB on Linux.

About the middle of 2005, most distributions started shipping with a driver called 'garmin_gps' that claims a USB Garmin device and makes it accessible via a serial port. If you want to use that driver and it actually works for you (a depressingly uncommon situation) this is OK and you can access the device as 'ttyUSB0' or whatever that driver names your dev node. If you want to use GPSBabel's own very well supported USB code and access it as 'usb:', you must remove that driver via rmmod and probably prevent it from loading again. It is our strong recommendation to use the latter approach.

By default, only root can access the USB devices directly as we do for the 'usb:' case. It is possible to have the system automatically set the permissions on a USB device when it's detected. This eliminates the need for GPSBabel to run as root when using a device controlled by libusb, such as the Garmin 60CSx, VistaC, or LegendC units.

The steps to address both of these issues are simple for an admin. The locations of files may vary between distributions and even versions, but the following examples may hopefully help inspire you:

Fedora

Fedora Core 2

Fedora Core 3

Fedora Core 4

  • Edit /etc/hotplug/usb.usermap and insert the following:
    # Garmin
    garmin 0x0000 0x091e 0x0000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
  • Create a file named /etc/hotplug/usb/garmin to adjust ownership and permissions to your needs. A single user workstation may find a very simple policy to look like:

    #!/bin/bash

    if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
    then
    # Uncomment next line for FC4 to remove conflicting kernel module
      # rmmod garmin_gps
      chmod 666 $DEVICE
    fi

  • Make that executable with chmod 755 /etc/hotplug/usb/garmin.
That's it, you should now be able to use your USB Garmin. Just use "usb:" as your filename instead of an entry in /dev. For example: gpsbabel -t -r -w -i garmin -f usb: -o gpx -F blah.gpx will make a backup copy of the tracks, routes, and waypoints for you.

Fedora Core 5

Fedora Core 6

Fedora Core 7

Fedora Core 8

FC5 replaces hotplug with udev, rendering ineffective the above attempt to keep the kernel driver peanut butter out of our chocolate. For FC5, the correct approach appears to be to add 'blacklist garmin_gps' to the end of /etc/modprobe.conf.

If you modify the above, you can usually save yourself a reboot cycle by running /sbin/rmmod garmin_gps as root.

If you want udev to create the devices so they are readable and writable by non-priveleged users, create a file /etc/udev/rules.d/51-garmin.rules with contents
SYSFS{idVendor}=="091e", SYSFS{idProduct}=="0003", MODE="0666"

Libusb must be in the range of version 0.1.10 to 0.1.12 in order for Garmin USB to work.

Fedora Core 14

As above for FC5, but add blacklist garmin_gps to the end of /etc/modprobe.d/blacklist.conf instead.

Suse

SuSe 10.1

See instructions for Fedora Core 5.

SuSe 10.1 is reported to need a manual upgrade of libusb.

Ubuntu

Dapper Drake

To keep the OS from loading the (frequently dysfunctional) kernel garmin_gps module, edit /etc/modprobe.d/blacklist and add the lines

# stop garmin_gps serial from loading for USB garmin devices

blacklist garmin_gps

To allow the USB devices to be read and written by a non-privileged user, create a file named /etc/udev/rules.d/51-garmin.rules with the following contents:


SYSFS{idVendor}=="091e", SYSFS{idProduct}=="0003", MODE="666"

Ubuntu Edgy

The instructions above for Dapper Drake seem to apply, but another peril awaits users of Ubuntu 7.04 with kernel 2.6.20-15. This product ships with a kernel built with CONFIG_USB_SUSPEND which apparently breaks the libusb support that we need. Recompile your kernel without this options and/or contact your support provider for current status or help.

In April of 2008, Babel-head Bill Wohler reported that Debian kernel 2.6.24 included a fix for this problem.

Ubuntu Feisty

Roger Dean reports that in June 2007, Ubuntu released a downloadable update for Feisty 7.04, kernel 2.6.20-16. This seems to fix the problem described above on his system at least.

(This was written 2006-May-16 Please let the gpsbabel-misc list know if there is any progress on this.)

Ubuntu Gutsy

There has been a lot of confusion on the GPSBabel list about Gutsy.

Gutsy apparently already includes the entry in blacklist, so that should be helpful. Of course, if you're building your own static kernels, you must remember to deconfigure garmin_gps.

Some users report the 'Edgy' problem above has been fixed and some are claiming it's not. Some report that the rules syntax given above for Dapper Drake work successfully and othere report that
USBSYSTEM!="usb_device", GOTO="garmin_rules_end" ACTION!="add", GOTO="garmin_rules_end" ATTRS{idVendor}=="091e", ATTRS{idProduct}=="0003", MODE="0660", GROUP="plugdev" LABEL="garmin_rules_end"
is required in the udev rules file.

If you can help clarify this, please contact us.

Ubuntu Hardy

It appears that Hardy is more like Dapper than Gutsy.

Create /etc/udev/rules.d/51-garmin.rules with SYSFS{idVendor}=="091e", SYSFS{idProduct}=="0003", MODE="666" and do a sudo udevcontrol reload_rules.

Debian

To keep the OS from loading the kernel garmin_gps module, edit /etc/modprobe.d/blacklist and add the lines
# stop garmin_gps serial from loading for USB garmin devices
blacklist garmin_gps

To allow the USB devices to be read and written by a non-privileged user, create a file named /etc/udev/rules.d/51-garmin.rules with the following contents:

SYSFS{idVendor}=="091e", SYSFS{idProduct}=="0003", MODE="666", GROUP="plugdev"

Mandriva

To keep the OS from loading the kernel garmin_gps module, edit /etc/modprobe.d/blacklist-mdv and add the lines
# stop garmin_gps serial from loading for USB garmin devices
blacklist garmin_gps

To allow the USB devices to be read and written by a non-privileged user, create a file named /etc/udev/rules.d/51-garmin.rules with the following contents:

SYSFS{idVendor}=="091e", SYSFS{idProduct}=="0003", MODE="666", GROUP="plugdev"