Tigge / antfs-cli

Extracts FIT files from ANT-FS based sport watches such as Garmin Forerunner 60, 405CX, 310XT, 610 and 910XT.
MIT License
312 stars 77 forks source link

Syncing Vivofit 2: "error: unpack requires a string argument of length 16' (program.py:369)" #162

Open bistullapagredo opened 7 years ago

bistullapagredo commented 7 years ago

Hi, uhm ... I just installed openant and antfs-cli following this instruction (sorry, it's in german). Basically it tells me to get git, python, openant and antfs-cli and how to compile the latter two. Up to this it worked without showing an error message.

Interestingly, I didn't see anything about "Vivofit 2", which I own, anywhere. Still tried it - and ended up with the error message given in the title. I'll attach the complete logfile also.

Is this model/data format something your software is not yet aware of or is this a beginners mistake? Is there something I can do to make it work? 20170112-001633-antfs-cli.log.txt

Tigge commented 7 years ago

Thank you for reporting this. I'll try to look into this tonight!

Tigge commented 7 years ago

It seems to fail on setting the time. For some reason it is not returning what I'm expecting. 24 bytes instead of 16, not sure what is correct - the ANT-FS documentation is somewhat lacking here.

Try prefixing the lines https://github.com/Tigge/antfs-cli/blob/master/antfs_cli/program.py#L196-L203 with a # and see if you can get any further.

Tigge commented 7 years ago

For reference, I've asked for clarification in the ANT forums: https://www.thisisant.com/forum/viewthread/4618/.

bistullapagredo commented 7 years ago

Ok, so I tried what you suggested. Unfortunately there are two sets of program files: ./antfs-cli/antfs_cli and ./antfs-cli/build/lib.linux-x86_64-2.7/antfs_cli I have no idea which one will be called by the console command, so I tried adjusting either one - I don't have the impression that something changed:

1st try: Resulting console output:

j@bb3-u:~$ antfs-cli
Driver available: [<class ant.base.driver.USB2Driver at 0x7fe5703604c8>, <class ant.base.driver.USB3Driver at 0x7fe570360530>]
 - Using: ant.base.driver.USB3Driver
Request basic information...
  Capabilities:  array('B', [8, 8, 0, 186, 54, 0, 223])
Starting system...
Key done...
Searching...
Authenticating with vívofit 2 (3909646805)
 - Passkey: OK
 - Set time: FAILED
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/antfs_cli/program.py", line 356, in main
    g.start()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 217, in start
    self._main()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 155, in _main
    self.on_transport(beacon)
  File "build/bdist.linux-x86_64/egg/antfs_cli/program.py", line 205, in on_transport
    directory = self.download_directory()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 338, in download_directory
    return Directory.parse(data)
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/file.py", line 79, in parse
    files.append(File.parse(item_data))
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/file.py", line 167, in parse
    index, data_type, data_flags, flags, file_size, file_date = struct.unpack("<HB3xBBII", data)
error: unpack requires a string argument of length 16
Interrupted: unpack requires a string argument of length 16
j@bb3-u:~$

According logfile: 20170113-161502-antfs-cli.log.txt

2nd try: Console output:

j@bb3-u:/$ antfs-cli
Driver available: [<class ant.base.driver.USB2Driver at 0x7f47fb5764c8>, <class ant.base.driver.USB3Driver at 0x7f47fb576530>]
 - Using: ant.base.driver.USB3Driver
Request basic information...
  Capabilities:  array('B', [8, 8, 0, 186, 54, 0, 223])
Starting system...
Key done...
Searching...
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/antfs_cli/program.py", line 356, in main
    g.start()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 217, in start
    self._main()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 152, in _main
    if self.on_authentication(beacon):
  File "build/bdist.linux-x86_64/egg/antfs_cli/program.py", line 164, in on_authentication
    serial, name = self.authentication_serial()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 375, in authentication_serial
    response = self._get_command()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 186, in _get_command
    c = self._queue.get(True, timeout)
  File "/usr/lib/python2.7/Queue.py", line 176, in get
    raise Empty
Empty
Interrupted: 
j@bb3-u:/$ 

According logfile: 20170113-162336-antfs-cli.log.txt

3rd try: Console output:

j@bb3-u:/$ antfs-cli
Driver available: [<class ant.base.driver.USB2Driver at 0x7f0a5e3b84c8>, <class ant.base.driver.USB3Driver at 0x7f0a5e3b8530>]
 - Using: ant.base.driver.USB3Driver
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/antfs_cli/program.py", line 354, in main
    g = AntFSCLI(config_dir, args)
  File "build/bdist.linux-x86_64/egg/antfs_cli/program.py", line 131, in __init__
    Application.__init__(self)
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 138, in __init__
    raise e
AntException: Timed out while waiting for message
Interrupted: Timed out while waiting for message
j@bb3-u:/$

According logfile: 20170113-163303-antfs-cli.log.txt

4th try: Console output:

j@bb3-u:/$ antfs-cli
Driver available: [<class ant.base.driver.USB2Driver at 0x7f6676d904c8>, <class ant.base.driver.USB3Driver at 0x7f6676d90530>]
 - Using: ant.base.driver.USB3Driver
Request basic information...
  Capabilities:  array('B', [8, 8, 0, 186, 54, 0, 223])
Starting system...
Key done...
Searching...
Authenticating with vívofit 2 (3909646805)
 - Passkey: OK
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/antfs_cli/program.py", line 356, in main
    g.start()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 217, in start
    self._main()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 155, in _main
    self.on_transport(beacon)
  File "build/bdist.linux-x86_64/egg/antfs_cli/program.py", line 198, in on_transport
    result = self.set_time()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 349, in set_time
    result = self._get_commandpipe()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 228, in _get_commandpipe
    return ant.fs.commandpipe.parse(self.download(0xfffe))
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/commandpipe.py", line 213, in parse
    return commandpipe_type._parse(data)
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/commandpipe.py", line 87, in _parse
    args = cls._parse_args(data)
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/commandpipe.py", line 83, in _parse_args
    return struct.unpack(cls._format, data)
error: unpack requires a string argument of length 16
 - Set time: Interrupted: unpack requires a string argument of length 16
j@bb3-u:/$ 

According logfile: 20170113-163330-antfs-cli.log.txt

5th try: Console output:

j@bb3-u:/$ antfs-cli
Driver available: [<class ant.base.driver.USB2Driver at 0x7f319c4b24c8>, <class ant.base.driver.USB3Driver at 0x7f319c4b2530>]
 - Using: ant.base.driver.USB3Driver
Request basic information...
  Capabilities:  array('B', [8, 8, 0, 186, 54, 0, 223])
Starting system...
Key done...
Searching...
Authenticating with vívofit 2 (3909646805)
 - Passkey: OK
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/antfs_cli/program.py", line 356, in main
    g.start()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 217, in start
    self._main()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 155, in _main
    self.on_transport(beacon)
  File "build/bdist.linux-x86_64/egg/antfs_cli/program.py", line 198, in on_transport
    result = self.set_time()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 349, in set_time
    result = self._get_commandpipe()
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/manager.py", line 228, in _get_commandpipe
    return ant.fs.commandpipe.parse(self.download(0xfffe))
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/commandpipe.py", line 213, in parse
    return commandpipe_type._parse(data)
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/commandpipe.py", line 87, in _parse
    args = cls._parse_args(data)
  File "/usr/local/lib/python2.7/dist-packages/ant/fs/commandpipe.py", line 83, in _parse_args
    return struct.unpack(cls._format, data)
error: unpack requires a string argument of length 16
 - Set time: Interrupted: unpack requires a string argument of length 16
j@bb3-u:/$ 

According logfile: 20170113-165606-antfs-cli.log.txt

As I'm not that much of a python guy, I'm not yet really sure what I was doing. But, strangely, I didn't see my own debug message either. Did I overlook it?

psukys commented 6 years ago

Can confirm that commenting out program.py and then rerunning sudo python setup.py install (maybe it would be nice not to run the installation with root permissions :question: ) I got my files downloaded