Closed one-giant-leap closed 2 years ago
I've managed to get it working. From what I can tell the issue was that multiple 'EVENT_RX_FAIL' messages would pile up when a large file transfer was taking place. When antfs-cli started to process the 'EVENT_RX_FAIL' messages upon having transferred the large file, it would time out prior to sending the next 'DOWNLOAD_REQUEST'.
The 'fix' was to check for any 'EVENT_RX_FAIL' messages and stop them going into the queue (code found in base/ant.py in openant).
# Channel event
elif (
message._id == Message.ID.RESPONSE_CHANNEL
and message._data[1] == 0x01
):
_logger.debug("Got channel event, %r", message)
if (
message._data[2] != Message.Code.EVENT_RX_FAIL
):
self._events.put(
(
"event",
(message._data[0], message._data[1], message._data[2:]),
)
)
elif message._id == Message.ID.BROADCAST_DATA:
self._on_broadcast(message)
elif message._id == Message.ID.ACKNOWLEDGED_DATA:
self._on_acknowledge(message)
elif message._id == Message.ID.BURST_TRANSFER_DATA:
self._on_burst_data(message)
else:
_logger.warning("Got unknown message, %r", message)
I am able to successfully download multiple small files without issue, however when a 'larger' file (e.g. 20910 bytes) is encountered, the 'larger' file will be downloaded successfully but the next file will produce a timeout.
For example, given the following Directory:
Downloading index 22 will fail and the following error is printed:
I have visibility into the device where the files originate (I have a debugger set up on the embedded device i.e. fitness watch). The device doesn't appear to receive the 'ANTFS_EVENT_DOWNLOAD_REQUEST' message from antfs-cli when the time comes to download the file in question (the one that follows a larger file). Hence, the device doesn't respond with the message that antfs-cli is waiting for and antfs-cli promptly times out (within 1-2 seconds of having downloaded the 'larger' file).
Any thoughts on what might be occurring? My next test is to see how long antfs-cli typically takes to time out after sending the 'ANTFS_EVENT_DOWNLOAD_REQUEST' message to the device. If it is after quite some time, then that suggests the time taken to download the 'larger' file is possibly starving a e.g. watchdog time or something similar.