Tigge/antfs-cli

AntFSDownloadException: ('Download request failed: ', 2)

Closed this issue · 12 comments

I have tried downloading my first training data from the brand new watch, and I got this error.

I tried doing the same for three times with sudo python garmin.py and I got following result:

http://pastebin.com/HunK87ZY

In the meantime the watch displays "Downloading" or somethng like this for some time, then goes back to clock mode.

It seems like I will have to install windows on a virtual machine or borrow my girlfriend's laptop, but since I prefer using linux for everything, in case more information is necessary please let me know. I really want this to run with my linux pc and my Garmin Swim.

I just tried the split branch, and here's what I got:

http://pastebin.com/VdJzWtYw

I think the files are correctly downloaded but I'm not sure what's up with the Timeout message.

Yeah timeouts happens from time to time. Hoping to make things a bit more
robust in the future -- but rerunning the script a few times should make it
download everything.

On 3 April 2014 19:56, Hayri Uğur notifications@github.com wrote:

I just tried the split branch, and here's what I got:

http://pastebin.com/VdJzWtYw

I think the files are correctly downloaded but I'm not sure what's up with
the Timeout message.


Reply to this email directly or view it on GitHubhttps://github.com//issues/93#issuecomment-39483343
.

Hi,

The downloaded filenames are, as you see in logs, like "1989-12-31_01-29-00_1_4.fit". I guess that 1989-12-31 is supposed to be date. Is that normal?

eBug commented

I'm having similar issue here:

http://pastebin.com/nUZYxs4v

I localize the error.
The first file returns DownloadResponse.Response.NOT_READABLE.
Treat this result and return empty data array.

diff --git a/ant/fs/manager.py b/ant/fs/manager.py
index 2f48f5a..ab8c02e 100644
--- a/ant/fs/manager.py
+++ b/ant/fs/manager.py
@@ -297,7 +297,8 @@ class Application:
             _logger.debug("Wait for response...")
             try:
                 response = self._get_command()
-                if response._get_argument("response") == DownloadResponse.Response.OK:
+                resp = response._get_argument("response")
+                if resp == DownloadResponse.Response.OK:
                     remaining    = response._get_argument("remaining")
                     offset       = response._get_argument("offset")
                     total        = offset + remaining
@@ -311,6 +312,9 @@ class Application:
                         return data
                     crc = response._get_argument("crc")
                     offset = total
+                elif resp == DownloadResponse.Response.NOT_READABLE:
+                    # skip download NOT_READABLE
+                    return data
                 else:
                     raise AntFSDownloadException("Download request failed: ",
                             response._get_argument("response"))
eBug commented

That patch worked for me. Thanks!

This should probably throw an exception instead and that exceptions should be handled here. In the split branch this probably won't happen anymore since it is now correctly looking at the readable flag.

I do not understand how you can generate an error.
Specification "ANT File Share (ANT-FS) Technical Specification"

Page 58, 12.7.2 Download Request Response (0x89), Table 12-10. ANT-FS Download Response.
Response:
0: Download Request OK
1: Data does not exist
2: Data exists but is not downloadable
3: Not ready to download
4: Request invalid
5: CRC incorrect

It is necessary to handle all the answers with Garmin Swim.
Add processing was one negative response "Data exists but is not downloadable".

I got the exact same problem today with my Garmin Swim, and it is totally fixed by alexey-su's patch. I strongly suggested to add it in since the key is there is a few files on GS not readable, so the safe way is to "skip" them instead of bailing out.
elif resp == DownloadResponse.Response.NOT_READABLE:
# skip download NOT_READABLE
return data
@Tigge, if you throw out exception, do you intend to fail this downloading or handle it gracefully and proceed? The downloading should still move onto the rest files on GS.
Don't why other watches do not have this problem.
And the end, many thanks to folks here to make this ANT+ working in Linux. :)

Please allow merge alexey-su's patch to the master branch. So Garmin Swim owner will be happy to check out and download files w/o any patch.

Is this still a problem with the split branch. I think this is fixed by correcting the is_readable function in Tigge/openant@6084d65. That function is in use https://github.com/Tigge/Garmin-Forerunner-610-Extractor/blob/split/antfs-cli.py#L216 so it should work, unless there is a problem elsewhere of course.

In ANT-FS CLI (a.k.a. Garmin-Extractor) it should be enough to just check this flag, if downloading after that throws an exception it should be because of an error. If it is still broken then the Garmin Swim is probably not behaving according to specification and if so then something like this patch + a warning or something should be fine.

Closing since it is probably fixed, feel free to reopen if not.