Saturday, June 28, 2014

Downloading FIT files manually from a Garmin 910xt

When Garmin switched from their ANT agent to Garmin Express, the first version(s) of Garmin Express would not save the FIT files on your machine after it sync'd with Garmin Connect. The switch from the ANT agent to Garmin Express also broke connectivity with Strava and any other website that relied on the Garmin web browser plugin.

The workaround was (is) to upload FIT files directly to any site that got their plugin connectivity broken. Since the FIT files were deleted with earlier versions of Garmin Express, they could not be found to upload (catch-22). The fix is to extract the files manually with the 
Garmin-Forerunner-610-Extractor tool - yes, it works on the Garmin 910xt despite the name.

Here are detailed instructions for installing and running the manual extraction tool on an Apple machine running OSX Mavericks or later (and probably Linux). I have no idea how to do this on a win-tel machine. Also note that this how I personally got things working. Your mileage may vary, and I am not responsible for any problems that arise out of the use of these instructions. If you have problems, feel free to post a detailed explanation of what went wrong, and I will try to help.

In your web browser go to http://www.libusb.org/ and click on the link to "Download the latest release tarball" of libusb (Currently libusb-1.0.18).


[Note: A few people have missed the capital "D" in "Development" and "Documents". The OS X HFS+ filesystem is case sensitive, so you must be sure to get the case correct.]
  1. Open the terminal (You can find this by opening the finder and selecting "Applications" and then "Utilities". Double click on "Terminal"). 
  2. Type the following command in the Terminal: mkdir -p ~/Documents/Development && cd ~/Documents/Development 
  3. Type the following command in the Terminal: git clone https://github.com/Tigge/Garmin-Forerunner-610-Extractor 
  4. Type the following command in the Terminal: cd ~/Documents/Development/Garmin-Forerunner-610-Extractor/ 
  5. Type the following command in the Terminal: sudo easy_install pyusb 
  6. Type the following command in the Terminal: cp ~/Downloads/libusb* ~/Documents/Development/Garmin-Forerunner-610-Extractor/ 
  7. Type the following command in the Terminal: tar -zxvf libusb-* 
  8. Type the following command in the Terminal: cd libusb* 
  9. Type the following command in the Terminal: ./configure && make && sudo make install 
  10. Type the following command in the Terminal: cd .. 
  11. Turn on your Garmin device. Once it is fully started, plug in your ANT USB stick. 
  12. Type the following command in the Terminal: sudo python ~/Documents/Development/Garmin-Forerunner-610-Extractor/garmin.py 
  13. If this is the first time you have done this, your Garmin 910xt should ask if you want to pair with the Garmin Extractor device. Select "Yes" with the arrow button and press the "Enter" button. 
  14. The FIT files will now start downloading (including those that Garmin Express and the ANT Agent will not download). 
  15. When the download is complete, you can find them in ~/.config/garmin-extractor/$NUMBER/activities ($NUMBER is unique to your device, it should be the only numbered directory in ~/.config/garmin-extractor). This is the directory you will select files from when you need to upload them to sites like Strava. 
Repeat steps 1, and 12 - 16 for subsequent extractions.


Update:

When running step 12, if you get an error similar to the following, it is probably because you have some other program accessing the ANT USB stick, like Garmin Express, or the old ANT Agent. Simply shut down the program in question, reinsert the ANT USB stick, and attempt step 12 again.

Driver available: [, ] - Using: ant.base.driver.USB2DriverTraceback (most recent call last):  File "garmin.py", line 336, in main    g = Garmin(options.upload)  File "garmin.py", line 137, in __init__    Application.__init__(self)  File "/Users/chuckwolber/Documents/Development/Garmin-Forerunner-610-Extractor/ant/fs/manager.py", line 82, in __init__    self._node = Node()  File "/Users/chuckwolber/Documents/Development/Garmin-Forerunner-610-Extractor/ant/easy/node.py", line 48, in __init__    self.ant = Ant()  File "/Users/chuckwolber/Documents/Development/Garmin-Forerunner-610-Extractor/ant/base/ant.py", line 59, in __init__    self._driver.open()  File "/Users/chuckwolber/Documents/Development/Garmin-Forerunner-610-Extractor/ant/base/driver.py", line 180, in open    dev.set_configuration()  File "build/bdist.macosx-10.9-intel/egg/usb/core.py", line 559, in set_configuration    self._ctx.managed_set_configuration(self, configuration)  File "build/bdist.macosx-10.9-intel/egg/usb/core.py", line 92, in managed_set_configuration    self.backend.set_configuration(self.handle, cfg.bConfigurationValue)  File "build/bdist.macosx-10.9-intel/egg/usb/backend/libusb1.py", line 741, in set_configuration    _check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))  File "build/bdist.macosx-10.9-intel/egg/usb/backend/libusb1.py", line 571, in _check    raise USBError(_str_error[ret], ret, _libusb_errno[ret])USBError: [Errno 19] No such device (it may have been disconnected)Interrupted: [Errno 19] No such device (it may have been disconnected)


Update 20Nov2014:

I tested this with a Garmin FR60 and it worked great.


Update 02Jul2015:

If you get the following, error or something like it:

can't open file '/Users/Aaron/documents/development/garmin-forerunner-610-extractor/garmin.py': [Errno 2] No such file or directory

You probably neglected to capitalize the "D" in Documents and/or the "D" in Development. Look through the execution path carefully for "Documents" and "Development" and make sure you capitalize the "D".

18 comments:

Unknown said...

Great stuff Chuck, I recovered an 87km ride with your instructions. Thanks a lot! Gael

Chuck Wolber said...

Glad I could help :)

Unknown said...

I get an error:

can't open file '/Users/Aaron/documents/development/garmin-forerunner-610-extractor/garmin.py': [Errno 2] No such file or directory

I've tried re-performing the procedure and get the same thing.

Chuck Wolber said...

Aaron - I am pretty sure your directory path is wrong. Make sure to capitalize the "D" in Documents.

OS X generally uses a case sensitive file system. You have to make sure everything is capitalized correctly - "documents" is not the same as "Documents".

Maarten Schmidt said...

I get the same error,

can't open file '/Users/Aaron/documents/development/garmin-forerunner-610-extractor/garmin.py': [Errno 2] No such file or directory

When I check the directory, there's no such file there

Chuck Wolber said...

Maarten - Same advice to you as to Aaron. Your directory path is incorrect. You need to capitalize the "D" in Documents and the "D" in Development.

Maarten Schmidt said...

Already tried that, same message... And I don't find the garmin.py file in the directory

python: can't open file '/Users/administrator/Documents/Development/Garmin-Forerunner-610-Extractor/garmin.py': [Errno 2] No such file or directory

Unknown said...

Hello Chuck,

I do get the same error as Maarten. The file garmin.py is simply not in that folder and I checked the spelling of the paths throughout the process...

Thanks for any assistance in advance..

Jon said...

Hoping for this to work, My first Ironman bike and run is not extracting via communicator, had good data and functionality on watch all the race. Starting now using your guide....

Jon said...

same error. there simply is no /garmin.py file.
Seems the Garmin-Forerunner-610-Extractor is updated to antfs-cli. Maybe thats why not working. Im trying to get this to work but have no skills. If you have the time to update your guide I would be very happy.

Chuck Wolber said...

I am usually hanging out in #linux on irc.taclug.org. If you know how to use IRC, jump in there and ask for help. Once we figure out what the problem is, I can post a solution here.

Unknown said...

Trying this out as my file was apparently corrupted and Garmin can't do anything to help. At Step 12 I'm getting the error message others have mentioned - python: can't open file '/Users/keithbnowak/Documents/Development/Garmin-Forerunner-610-Extractor/garmin.py': [Errno 2] No such file or directory. Any suggestions on how to resolve this?

Unknown said...

Thanks for making this tool available, Chuck.
I too am getting an error at step 12 (and the garmin.py file is not present in the required folder.)
I believe the garmin.py file is created during step 9. The following is the data from Terminal starting at step 9 which appears to create a warning that prevents the garmin.py from being created? (I know only enough about this stuff to be dangerous!!)
I'm running on an iMac with OS 10.10.3
Here's the dump from Terminal. Maybe this helps a bit:

Yard-iMac:libusb-1.0.9 Chris$ ./configure && make && sudo make install

... a bunch of stuff ...

/Library/Developer/CommandLineTools/usr/bin/make all-recursive
Making all in libusb
CC libusb_1_0_la-core.lo
CC libusb_1_0_la-descriptor.lo
CC libusb_1_0_la-io.lo
CC libusb_1_0_la-sync.lo
CC libusb_1_0_la-darwin_usb.lo
os/darwin_usb.c:1151:27: warning: expression which evaluates to zero treated as a null pointer constant of type 'IOUSBInterfaceInterface300 **'
(aka 'struct IOUSBInterfaceStruct300 **') [-Wnon-literal-null-conversion]
cInterface->interface = IO_OBJECT_NULL;
^~~~~~~~~~~~~~
/System/Library/Frameworks/IOKit.framework/Headers/IOTypes.h:164:24: note: expanded from macro 'IO_OBJECT_NULL'
#define IO_OBJECT_NULL ((io_object_t) 0)
^~~~~~~~~~~~~~~~~
1 warning generated.
CC libusb_1_0_la-threads_posix.lo
CCLD libusb-1.0.la
Making all in doc
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all-am'.
Making install in libusb
test -z "/usr/local/lib" || .././install-sh -c -d "/usr/local/lib"
/bin/sh ../libtool --mode=install /usr/bin/install -c libusb-1.0.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libusb-1.0.0.dylib /usr/local/lib/libusb-1.0.0.dylib
libtool: install: (cd /usr/local/lib && { ln -s -f libusb-1.0.0.dylib libusb-1.0.dylib || { rm -f libusb-1.0.dylib && ln -s libusb-1.0.0.dylib libusb-1.0.dylib; }; })
libtool: install: /usr/bin/install -c .libs/libusb-1.0.lai /usr/local/lib/libusb-1.0.la
libtool: install: /usr/bin/install -c .libs/libusb-1.0.a /usr/local/lib/libusb-1.0.a
libtool: install: chmod 644 /usr/local/lib/libusb-1.0.a
libtool: install: ranlib /usr/local/lib/libusb-1.0.a
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
during execution

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
test -z "/usr/local/include/libusb-1.0" || .././install-sh -c -d "/usr/local/include/libusb-1.0"
/usr/bin/install -c -m 644 libusb.h '/usr/local/include/libusb-1.0'
Making install in doc
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/lib/pkgconfig" || ./install-sh -c -d "/usr/local/lib/pkgconfig"
/usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig'
Yard-iMac:libusb-1.0.9 Chris$ cd ..
Yard-iMac:Garmin-Forerunner-610-Extractor Chris$ sudo python ~/Documents/Development/Garmin-Forerunner-610-Extractor/garmin.py
python: can't open file '/Users/Chris/Documents/Development/Garmin-Forerunner-610-Extractor/garmin.py': [Errno 2] No such file or directory

Unknown said...

Hi Chuck,
I am afraid I have the same challenge. There is no garmin.py in ./Documents/Development/Garmin-Forerunner-610-Extractor/
I had the same terminal feedback as the previous commenter.

Can the same function be performed by any of the other python scripts that are in some of the subdirectories?

Jason
PS Instructions were follow with respect to the case for Documents and Development.

Charlie said...

Hey Chuck --

I'm also not seeing a garmin.py file anywhere in the package. I've hit up the IRC channel a few times a week for the last few weeks to see if you were hanging out but didn't see anyone that looked like you.

I went through the entire process with both the libusb-1.0.18 (version when you wrote the post) and the latest version (libusb-1.0.9). Any ideas since the last comment about why the garmin.py file might be totally missing from the package?

Thanks!

joneswah said...

The reason why garmin.py is not found is because the maker of the software made major updates to the software in 2015 and the new version does not contain garmin.py anymore. https://github.com/Tigge/antfs-cli. It is now called antfs-cli. The old version of the code which contains garmin.py can still be accessed here https://github.com/Tigge/antfs-cli/tree/old

Kim said...

To all of you people how are trying this out 2016; change /garmin.py to setup.py and after that type antfs-cli and just click yes on your garmin device. Simple as that.

Alan said...

When I get to step 6, I am told:..."Downloads/libusb-1.0.9 is a directory (not copied)."
Thanks for your help!
Alan