Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ttwatch does not find new device #121

Open
vmindru opened this issue Mar 16, 2017 · 27 comments
Open

ttwatch does not find new device #121

vmindru opened this issue Mar 16, 2017 · 27 comments

Comments

@vmindru
Copy link

vmindru commented Mar 16, 2017

Hi i can not perform initial setup on tomtom touch

[vmindru@zetor ~]$ ttwatch --initial-setup
Unable to open watch
[vmindru@zetor ~]$ ttwatch --devices
[vmindru@zetor ~]$ 
[vmindru@zetor ~]$ lsusb | grep -i tom
Bus 003 Device 005: ID 1390:7480 TOMTOM B.V. 
[vmindru@zetor ~]$ 
Mar 16 15:49:10 zetor kernel: usb 3-7: USB disconnect, device number 8
Mar 16 15:49:18 zetor kernel: usb 3-7: new full-speed USB device number 9 using xhci_hcd
Mar 16 15:49:18 zetor kernel: usb 3-7: New USB device found, idVendor=1390, idProduct=7480
Mar 16 15:49:18 zetor kernel: usb 3-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Mar 16 15:49:18 zetor kernel: usb 3-7: Product: TomTom Fitness Band
Mar 16 15:49:18 zetor kernel: usb 3-7: Manufacturer: TomTom
Mar 16 15:49:18 zetor kernel: usb 3-7: SerialNumber: JC2476H*****
Mar 16 15:49:18 zetor kernel: hid-generic 0003:1390:7480.0008: hiddev0,hidraw4: USB HID v1.01 Device [TomTom TomTom Fitness Band] on usb-0000:00:14.0-7/input0
Mar 16 15:49:18 zetor mtp-probe[4136]: checking bus 3, device 9: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-7"
Mar 16 15:49:18 zetor mtp-probe[4136]: bus: 3, device: 9 was not an MTP device

@ryanbinns
Copy link
Owner

Does it work if you run sudo ttwatch --devices?

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

nope =( not a perms issue

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

I will try to install this now on my laptop. let's see how this goes.

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

same problem on Fedora 23

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

ok i got it partially working with

[vmindru@vmindru ttwatch]# git diff src/libttwatch.cpp
diff --git a/src/libttwatch.cpp b/src/libttwatch.cpp
index 985d2de..037914f 100644
--- a/src/libttwatch.cpp
+++ b/src/libttwatch.cpp
@@ -354,9 +354,9 @@ int ttwatch_open_device(libusb_device *device, const char *serial_or_name, TTWAT
 
     // ignore any non-TomTom devices
     // PID 0x7474 is Multisport and Multisport Cardio
-    if ((desc.idVendor  != TOMTOM_VENDOR_ID) ||
-        ((desc.idProduct != TOMTOM_MULTISPORT_PRODUCT_ID) &&
-         !IS_SPARK(desc.idProduct)))
+    if ((desc.idVendor  != TOMTOM_VENDOR_ID))
+//        ((desc.idProduct != TOMTOM_MULTISPORT_PRODUCT_ID) &&
+//         !IS_SPARK(desc.idProduct)))
     {
         *watch = 0;
         return TTWATCH_NotAWatch;
@@ -411,7 +411,7 @@ int ttwatch_open_device(libusb_device *device, const char *serial_or_name, TTWAT
     if (count > 0)
         ((char*)(*watch)->serial_number)[count] = 0;
 
-    RETURN_ERROR(ttwatch_send_startup_message_group(*watch));
+//    RETURN_ERROR(ttwatch_send_startup_message_group(*watch));
 
     // get the watch name
     if (ttwatch_get_watch_name(*watch, name, sizeof(name)) != TTWATCH_NoError)
[vmindru@vmindru ttwatch]# 

now at least I can list devices, but I think I am hitting some firmware incompatibility thingy

[root@vmindru ~]# ttwatch --update-fw                                                                    
Unable to determine firmware verion information
[root@vmindru ~]# ttwatch --all-settings
Firmware version not supported
Unable to read manifest entry
[root@vmindru ~]# 
[root@vmindru ~]# ttwatch -v
Product ID:       0x00000000
BLE Version:      0
Firmware Version: 0.0.0
Unable to read watch name
[root@vmindru ~]# 

@ryanbinns
Copy link
Owner

Yes, that will make it partially work, but only because you're disabling all the error-checking to make sure it's a watch you're talking to.

What you have is a new watch that has a unsupported product ID, and seems to communicate differently. It might use the new Spark protocol, so try applying this patch and have another go:

diff --git a/include/libttwatch.h b/include/libttwatch.h
index 18bc8e6..c9016c3 100755
--- a/include/libttwatch.h
+++ b/include/libttwatch.h
@@ -20,10 +20,12 @@ extern "C" {
 #define TOMTOM_MULTISPORT_PRODUCT_ID    (0x7474)
 #define TOMTOM_SPARK_MUSIC_PRODUCT_ID   (0x7475)
 #define TOMTOM_SPARK_CARDIO_PRODUCT_ID  (0x7477)
+#define TOMTOM_TOUCH_PRODUCT_ID         (0x7480)

 #define IS_SPARK(id)                            \
     (((id) == TOMTOM_SPARK_MUSIC_PRODUCT_ID) || \
-     ((id) == TOMTOM_SPARK_CARDIO_PRODUCT_ID))  \
+     ((id) == TOMTOM_SPARK_CARDIO_PRODUCT_ID) || \
+     ((id) == TOMTOM_TOUCH_PRODUCT_ID))  \


 /*****************************************************************************/

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

damn ... I spotted this yesterday while going trough the code. However missed the part to add it to the
IS_SPARK let me try that.

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

btw @ryanbinns I think you are missing a parenthesis.

@ryanbinns
Copy link
Owner

I don't think so. It compiled fine for me...

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

actually, you are right, I just patched "manually" and pasted something wrong. went just fine with git apply. I feel we are one step closure :-D now the command just hangs for 20 seconds.

[root@vmindru ~]# time ttwatch --devices                                                                  

real    0m20.029s
user    0m0.014s
sys     0m0.011s
[root@vmindru ~]# time ttwatch --devices

real    0m20.017s
user    0m0.003s
sys     0m0.008s
[root@vmindru ~]# time ttwatch -v
Unable to open watch

real    0m20.014s
user    0m0.003s
sys     0m0.006s
[root@vmindru ~]# time ttwatch -v
Unable to open watch

real    0m20.013s
user    0m0.003s
sys     0m0.006s
[root@vmindru ~]# 

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

let me pull out an strace, maybe it will help.

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

here is the strace with hanging command after your patch suggestion http://pastebin.com/wP9yRhLC

@ryanbinns
Copy link
Owner

I've never tried debugging using strace before, so I'm not sure how to interpret that. The delay generally only happens if the watch is busy. Can you verify that no other program is trying to use it? No other lingering copies of ttwatch in the background. I assume you're not trying to run the daemon at the moment.

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

@ryanbinns i don't seem to run the daemon at least i did not start it, let me try to make sure nothing else would be polling it.

@ryanbinns
Copy link
Owner

Try running lsof | grep dev/bus/usb to see if there is a process that's holding the watch open. You could try reinserting it also.

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

Ok I have disabled again error-cheking and we are back where we where, I guess your assumption that the watch is using the Spark protocol is not true :( cause the ttwatch still can not talk to TomTom Touch :( .

[root@vmindru ttwatch]# ttwatch -v
PollingProduct ID:       0x00000000
BLE Version:      0
Firmware Version: 0.0.0
Unable to read watch name

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

btw at the runtime nothig else is opening the watch

[root@vmindru ttwatch]# lsof | grep dev/bus/usb
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
ttwatch   17038          root    9u      CHR            189,143       0t0  138292980 /dev/bus/usb/002/016
ttwatch   17038 17039    root    9u      CHR            189,143       0t0  138292980 /dev/bus/usb/002/016
[root@vmindru ttwatch]#
[root@vmindru 002]# lsusb | grep TOM
Bus 002 Device 016: ID 1390:7480 TOMTOM B.V. 
[root@vmindru 002]# 

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

Let me try to contact support and see if they are willing to share some info on the protocol this wristband is using.

VM

@ryanbinns
Copy link
Owner

Your lsof output indicates there is a copy of ttwatch running that has a watch open. Or at least, it did a short time ago. Sometimes lsof takes a while to realise the device is closed. Does anything show up if you run ps -ef | grep ttwatch.

No, they won't help. I had to reverse engineer the watch myself to work out how to talk to it.

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

@ryanbinns bastards :(

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

@ryanbinns btw thanks a lot for trying to help here, if you want we can switch to IM not to pollute this thread. do you use IRC? if yes i am under nick:vmindru on freenode

[root@vmindru ~]# lsof | grep -i /dev/usb/
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
[root@vmindru ~]# ps ufax | grep ttwatch
root     27827  0.0  0.0 118488  2248 pts/8    S+   13:13   0:00                  \_ grep --color=auto ttwatch
[root@vmindru ~]# 

@ryanbinns
Copy link
Owner

No, I don't use any IM.

It seems like this watch uses a different protocol, so we may have to do a packet sniff while the Windows software is talking to the watch. Do you have a Windows PC you can use to do this? I used Wireshark/USBPcap to dump the raw packets and then went through them by hand with a hex editor to decipher what was going on. Hopefully the basic protocol will be similar, but there may be some low-level differences (the original vs Spark watches had a different packet size but the rest was the same, for example).

@vmindru
Copy link
Author

vmindru commented Mar 17, 2017

I will have to find a windows box :( and try to discover this part. I will let you know when/if I have any data.
Thank you for now!

@DrYak
Copy link

DrYak commented Sep 13, 2018

Hello, did you guys managed to get the Tomtom Touch working with ttwatch eventually ?

@nimrodxx
Copy link

Is there still activity with this Issue?

I own one of these watches, if it helps i can contribute usb-dumps and try some coding (but only with very basic skills ;-)

@ryanbinns
Copy link
Owner

No, development on this project is practically dead as the watch is not supported by TomTom anymore. My watch has died so I have no means for testing or development anyway.

@brocciu
Copy link

brocciu commented Nov 15, 2023

Hello, I have a new watch (touch) and I have ttwatch working on my mac. I have the message "Unable to open watch" even with "sudo".
Do you have a solution to set up a new watch with ttwatch ?
Thank you,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants