#1751 Fossil Hybrid HR

Open
opened 3 months ago by imdanperks · 32 comments

Before reporting a bug, please confirm the following:

  • I have read the wiki, and I didn't find a solution to my problem / an answer to my question.
  • I have searched the issues, and I didn't find a solution to my problem / an answer to my question.
  • If you upload an image or other content, please make sure you have read and understood the github policies and terms of services

I got Gadgetbridge from:

  • F-Droid
  • I built it myself from source code (specify tag / commit)

Your issue is:

My device doesn't pair correctly with GadgetBridge. The pairing process goes as follows:

  • I first unpair the watch from the Fossil app by removing it in the app, force stopping the app, clearing its cache and removing it from my Bluetooth devices. I then reboot.
  • In the GadgetBridge app, the device shows under the discovery. I choose to pair it to my device.
  • Once finished, it goes back to the blank GadgetBridge home screen, with no new addition of my device there. The notification at this time says the full name of my device, with the status ‘Connecting...'. This does not change. Also, in this process, the hands on the watch turn to show some kind of connection. However, at no point am I told to authorise it by holding the middle button, as required when pairing to the app.
  • A reboot of the app or my phone changes nothing. The notification after either of these changes to say ‘No Device Connected’, and the notification freezes if the connect button is pressed.
  • After this process, the only way GadgetBridge would see the device is if I paired it through the Fossil app after. However, once I did this, GadgetBridge seemed to have no ability to read or write from the device. Unpairing the device from the Fossil app returned GadgetBridge to the point where it cannot see the device again.

Linked below is a log file (can't upload here???), starting from a fresh install of GadegtBridge, with my device not currently paired to either the Fossil app or the device itself. I tried to pair the device, got to the point where the pairing process was complete but the device was not showing in the app, but the notification says ‘Connecting’. I waited in this state for a few minutes before closing the app and repairing to the Fossil app. As this screen was displayed, the hands on the device rotated like before. On the watches display, it says it is connecting to a device, but any options to interact with the phone (e.g. find my device) were unsuccessful.

LOG FILE: https://pastebin.com/xKTMVWnq

Your wearable device is:

Fossil Q Hybrid Collider HR (Firmware No: DN1.0.2.14r.v4)

Your android version is:

Android 9 on my Samsung Galaxy Note 8

Your Gadgetbridge version is:

0.40.0

#### Before reporting a bug, please confirm the following: - [x] I have read the [wiki](https://github.com/Freeyourgadget/Gadgetbridge/wiki), and I didn't find a solution to my problem / an answer to my question. - [x] I have searched the [issues](https://github.com/Freeyourgadget/Gadgetbridge/issues), and I didn't find a solution to my problem / an answer to my question. - [x] If you upload an image or other content, please make sure you have read and understood the [github policies and terms of services](https://help.github.com/articles/github-terms-of-service/#1-responsibility-for-user-generated-content) ### I got Gadgetbridge from: * [x] F-Droid * [ ] I built it myself from source code (specify tag / commit) #### Your issue is: My device doesn't pair correctly with GadgetBridge. The pairing process goes as follows: - I first unpair the watch from the Fossil app by removing it in the app, force stopping the app, clearing its cache and removing it from my Bluetooth devices. I then reboot. - In the GadgetBridge app, the device shows under the discovery. I choose to pair it to my device. - Once finished, it goes back to the blank GadgetBridge home screen, with no new addition of my device there. The notification at this time says the full name of my device, with the status 'Connecting...'. This does not change. Also, in this process, the hands on the watch turn to show some kind of connection. However, at no point am I told to authorise it by holding the middle button, as required when pairing to the app. - A reboot of the app or my phone changes nothing. The notification after either of these changes to say 'No Device Connected', and the notification freezes if the connect button is pressed. - After this process, the only way GadgetBridge would see the device is if I paired it through the Fossil app after. However, once I did this, GadgetBridge seemed to have no ability to read or write from the device. Unpairing the device from the Fossil app returned GadgetBridge to the point where it cannot see the device again. Linked below is a log file (can't upload here???), starting from a fresh install of GadegtBridge, with my device not currently paired to either the Fossil app or the device itself. I tried to pair the device, got to the point where the pairing process was complete but the device was not showing in the app, but the notification says 'Connecting'. I waited in this state for a few minutes before closing the app and repairing to the Fossil app. As this screen was displayed, the hands on the device rotated like before. On the watches display, it says it is connecting to a device, but any options to interact with the phone (e.g. find my device) were unsuccessful. LOG FILE: https://pastebin.com/xKTMVWnq #### Your wearable device is: Fossil Q Hybrid Collider HR (Firmware No: DN1.0.2.14r.v4) #### Your android version is: Android 9 on my Samsung Galaxy Note 8 #### Your Gadgetbridge version is: 0.40.0
ashimokawa commented 3 months ago
Owner

@imdanperks

Your device is not a Fossil Q Hybrid. It is a Fossil Hybrid HR. And that is not yet supported by Gadgetbridge.

There is a branch created by @dakhnod, in this repository, which has experimental support, but it requires you to get hold of a secret key, probably with a rooted phone from the fossil app database (this is purely my speculation, based on how it works with the Mi Band 4).

Please be patient while the branch evolves, I might be able to help once I get the watch.

@imdanperks Your device is not a Fossil Q Hybrid. It is a Fossil Hybrid HR. And that is not yet supported by Gadgetbridge. There is a branch created by @dakhnod, in this repository, which has experimental support, but it requires you to get hold of a secret key, probably with a rooted phone from the fossil app database (this is purely my speculation, based on how it works with the Mi Band 4). Please be patient while the branch evolves, I might be able to help once I get the watch.
ashimokawa added the
device fossil
label 3 months ago
imdanperks commented 3 months ago
Poster

Ahh, my bad. Model numbers get confusing!

Ahh, my bad. Model numbers get confusing!
imdanperks commented 3 months ago
Poster

@dakhnod Would I be able to test your experimental version? I'm rooted and can be very active, to help test and develop your branch. I'm not in a state to compile the APKs myself, but I could probably do so within the week.

@dakhnod Would I be able to test your experimental version? I'm rooted and can be very active, to help test and develop your branch. I'm not in a state to compile the APKs myself, but I could probably do so within the week.
dakhnod commented 3 months ago
Collaborator

@imdanperks could you please do me a favor and find where the device key is stored by the fossil app?

@imdanperks could you please do me a favor and find where the device key is stored by the fossil app?
ashimokawa changed title from Fossil Q Hybrid Won't Pair Correctly to Fossil Hybrid HR 3 months ago

Hey,

I think about getting a fossil Hybrid collider HR. As far as I understand this right, there will be support in the future, but I have to compile the app by myself. I'm right?

Hey, I think about getting a fossil Hybrid collider HR. As far as I understand this right, there will be support in the future, but I have to compile the app by myself. I'm right?
ashimokawa commented 2 months ago
Owner

@Micha_Btz

Yes there is a branch with incomplete WIP support.

But in any case you would need to get hold of a secret key, that requires you to use the official app once plus you need the knowledge of getting the key. :/

@Micha_Btz Yes there is a branch with incomplete WIP support. But in any case you would need to get hold of a secret key, that requires you to use the official app once plus you need the knowledge of getting the key. :/
TinCan commented 2 months ago

Could you give a short description on were to find the key in the fossil apps directory? I would guess somewhere in databases?

What is the procedure to use gadgetbridge then? Delete the fossil app without unpairing and start the fossil-q-hr branch gadgetbridge?

Thanks for the work so far, I would love to get rid of the official app.

Could you give a short description on were to find the key in the fossil apps directory? I would guess somewhere in databases? What is the procedure to use gadgetbridge then? Delete the fossil app without unpairing and start the fossil-q-hr branch gadgetbridge? Thanks for the work so far, I would love to get rid of the official app.
ashimokawa commented 2 months ago
Owner

@TinCan

No I think the key is somewhere encrypted with another key securely stored in the KeyStore. If you can find a way of getting it from there - that would be cool.

But there are at least two other, more difficult ways of getting the key, the one I used requires a lot of knowledge.

Right now I don't think it would make sense to document these methods, since support is in so early stages.

@TinCan No I think the key is somewhere encrypted with another key securely stored in the KeyStore. If you can find a way of getting it from there - that would be cool. But there are at least two other, more difficult ways of getting the key, the one I used requires a lot of knowledge. Right now I don't think it would make sense to document these methods, since support is in so early stages.

@ashimokawa

I have the clock since yesterday and some hints to get the key would be good. Even if I search for the key, how long is the key and need I to add some letters before like by the amazfit gtr?

@ashimokawa I have the clock since yesterday and some hints to get the key would be good. Even if I search for the key, how long is the key and need I to add some letters before like by the amazfit gtr?
ashimokawa commented 2 months ago
Owner

@Micha_Btz You cannot search for the key in the Fossil app, sorry. It is simply not there.

But anyway, if you insist to try, the key is 16 bytes log (128 bit), stored as hex the key would be 32 ASCII characters long.

In Gadgetbridge this key is prefixed with 0x

The way I got the key is really very complicated, and even if you manage to do it how I did it, you still will end up with very incomplete support in Gadgetbridge.

I think it would be best to wait till someone creates a modified app which spits out the key, like people did with Mi Fit. However personally won't be part of the effort, because that would be probably illegal.

The complicated way I used was without tampering with the original app.

If you are using the offical app, maybe you can answer if the watch is constantly vibration on incoming calls or if it will just disaplay a notification?

@Micha_Btz You cannot search for the key in the Fossil app, sorry. It is simply not there. But anyway, if you insist to try, the key is 16 bytes log (128 bit), stored as hex the key would be 32 ASCII characters long. In Gadgetbridge this key is prefixed with 0x The way I got the key is really very complicated, and even if you manage to do it how I did it, you still will end up with very incomplete support in Gadgetbridge. I think it would be best to wait till someone creates a modified app which spits out the key, like people did with Mi Fit. However personally won't be part of the effort, because that would be probably illegal. The complicated way I used was without tampering with the original app. If you are using the offical app, maybe you can answer if the watch is constantly vibration on incoming calls or if it will just disaplay a notification?
ashimokawa commented 2 months ago
Owner

@Micha_Btz @imdanperks

I have documented on how to get the key. Let's see how long it works, now that I have disclosed my method.

https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Fossil-Hybrid-HR

You might have to read tutorials on how to use mitmproxy with Android, that is probably not for the average user, you have been warned... :smirk:

@Micha_Btz @imdanperks I have documented on how to get the key. Let's see how long it works, now that I have disclosed my method. https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Fossil-Hybrid-HR You might have to read tutorials on how to use mitmproxy with Android, that is probably not for the average user, you have been warned... :smirk:

thanks a lot. works fine.I have build the debug app and there are some errors about AssetFilePutRequest, do you need the debug output?

thanks a lot. works fine.I have build the debug app and there are some errors about AssetFilePutRequest, do you need the debug output?
ashimokawa commented 2 months ago
Owner

@Micha_Btz

Congratulations :+1:

I am happy that my instructions were actually useful to at least you :)

We do not need debug output. This error happens when changing the widgets on the watchface.

Also I think it is not time for error reports yet - we are aware that thinks are not finished :)

@Micha_Btz Congratulations :+1: I am happy that my instructions were actually useful to at least you :) We do not need debug output. This error happens when changing the widgets on the watchface. Also I think it is not time for error reports yet - we are aware that thinks are not finished :)
TinCan commented 1 month ago

Hi,

as I was just too lazy to use mitmproxy I located the key in the configuration files of the original app.

/data/data/com.fossil.wearables.fossil/shared_prefs/TEXT_ENCRYPTION_PREFERENCE.xml

reads:

<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <string name="text_encryption_secret_key">SECRETKEY=&#10;    </string>
</map>

The first 16 bytes of echo "SECRETKEY=" | base64 -d | hexdump -C prefixed by 0x were indeed the infamous key and worked in Gadgetbridge.

Hi, as I was just too lazy to use mitmproxy I located the key in the configuration files of the original app. /data/data/com.fossil.wearables.fossil/shared_prefs/TEXT_ENCRYPTION_PREFERENCE.xml reads: ``` <?xml version='1.0' encoding='utf-8' standalone='yes' ?> <map> <string name="text_encryption_secret_key">SECRETKEY=&#10; </string> </map> ``` The first 16 bytes of `echo "SECRETKEY=" | base64 -d | hexdump -C ` prefixed by 0x were indeed the infamous key and worked in Gadgetbridge.

nice catch

nice catch
ashimokawa commented 1 month ago
Owner

@TinCan

Wait, wait, wait...

I know that key.

That key is used for encrypting/decrypting the logs. It is different from the pairing key here.

That key also never changes (because it is for the “global” device independent logs) when you remove or add new devices which all have different keys, so how can that work?

The only thing I can think about is that (due to a bug?) it is the same as the key which the first paired device gets IF the first attempt works (multiple pairing tries generate different device keys, but same log encryption key).

Can anyone confirm?

@TinCan Wait, wait, wait... I know that key. That key is used for encrypting/decrypting the logs. It is different from the pairing key here. That key also never changes (because it is for the "global" device independent logs) when you remove or add new devices which all have different keys, so how can that work? The only thing I can think about is that (due to a bug?) it is the same as the key which the first paired device gets IF the first attempt works (multiple pairing tries generate different device keys, but same log encryption key). Can anyone confirm?
asafb26 commented 1 month ago

Hi! Very interesting progress. This request made my choose that device instead of garmin :smile: Have a question regarding the integration - will it support tasker activities integration like “alarm triggered”? Thanks!

Hi! Very interesting progress. This request made my choose that device instead of garmin :smile: Have a question regarding the integration - will it support tasker activities integration like "alarm triggered"? Thanks!
hackoder commented 3 weeks ago

I built the version off master and IMO it works quite well. Being able to set a custom background is the only feature I was missing.

I did run into one bug; the time was off by one hour (I'm in EDT right now). Even after connecting to the official app and “fixing” the time, then reconnecting using GB with the ‘Sync Time’ setting to off, it would still change the time to be 1 hr less than the actual time. Any suggestions or workaround?

I built the version off master and IMO it works quite well. Being able to set a custom background is the only feature I was missing. I did run into one bug; the time was off by one hour (I'm in EDT right now). Even after connecting to the official app and "fixing" the time, then reconnecting using GB with the 'Sync Time' setting to off, it would still change the time to be 1 hr less than the actual time. Any suggestions or workaround?
hackoder commented 3 weeks ago

Also, I noticed there's a ‘time offset’ setting for Fossil hybrid watches, but that section isn't enable when connected to the Q HR.

Also, I noticed there's a 'time offset' setting for Fossil hybrid watches, but that section isn't enable when connected to the Q HR.
ashimokawa commented 3 weeks ago
Owner

@hackorder

EST is daylight saving time?

We still have standard time in Europe, so maybe we are just missing DST offset, should be an easy fix!

@hackorder EST is daylight saving time? We still have standard time in Europe, so maybe we are just missing DST offset, should be an easy fix!
ashimokawa commented 3 weeks ago
Owner

@hackorder

Can you try again?

@hackorder Can you try again?
hackoder commented 3 weeks ago

@ashimokawa That fixed it. Thanks for the quick fix!

@ashimokawa That fixed it. Thanks for the quick fix!
hackoder commented 3 weeks ago

For anyone else who'd like to test, here is what I've found so far:

For tasker (commute app) actions, you can handle intent: nodomain.freeyourgadget.gadgetbridge.Q_COMMUTE_MENU with param extra_action='destination’.

To send response for tasker (commute app) actions, send Intent: nodomain.freeyourgadget.gadgetbridge.Q_SET_MENU_MESSAGE with EXTRA_MESSAGE='your response’.

Button presses can be changed in service/devices/qhybrid/requests/fossil_hr/buttons/ButtonConfigurationPutRequest.java

I've found that the following apps work: commuteApp, weatherApp, musicApp, stopwatchApp.

@ashimokawa or @dakhnod is there an ‘app’ to get to the notification list?

For anyone else who'd like to test, here is what I've found so far: For tasker (commute app) actions, you can handle intent: nodomain.freeyourgadget.gadgetbridge.Q_COMMUTE_MENU with param extra_action='destination'. To send response for tasker (commute app) actions, send Intent: nodomain.freeyourgadget.gadgetbridge.Q_SET_MENU_MESSAGE with EXTRA_MESSAGE='your response'. Button presses can be changed in service/devices/qhybrid/requests/fossil_hr/buttons/ButtonConfigurationPutRequest.java I've found that the following apps work: commuteApp, weatherApp, musicApp, stopwatchApp. @ashimokawa or @dakhnod is there an 'app' to get to the notification list?
ashimokawa commented 3 weeks ago
Owner

@hackorder Thanks for the information!

But I removed link to decompiled code (Accidentally actually removed your whole post, sorry)

The core team does not use decomiled code, it is tempting and easy but legally questionable. We use bluetooth logs, it takes more time but should be safe.

I know the buttons have to be made configurable, that is on my list (currently I put weather on the upper button and left the rest to commuteApp).

@hackorder Thanks for the information! But I removed link to decompiled code (Accidentally actually removed your whole post, sorry) The core team does not use decomiled code, it is tempting and easy but legally questionable. We use bluetooth logs, it takes more time but should be safe. I know the buttons have to be made configurable, that is on my list (currently I put weather on the upper button and left the rest to commuteApp).
hackoder commented 3 weeks ago

@ashimokawa thanks, didn't know about that.

@ashimokawa thanks, didn't know about that.
hackoder commented 3 weeks ago

@ashimokawa I had just finished adding in configurable button actions (don't worry, mine was a crazy mish mash of bad code; I haven't used Java in ages, so I'm happy to see your changes) and when I went to pull master I realized you had made the changes too.

Just tested out your changes and they work very well. Thanks! I also used the Fossil app to update to the latest firmware, and the new firmware continues to work well with GB.

@ashimokawa I had just finished adding in configurable button actions (don't worry, mine was a crazy mish mash of bad code; I haven't used Java in ages, so I'm happy to see your changes) and when I went to pull master I realized you had made the changes too. Just tested out your changes and they work very well. Thanks! I also used the Fossil app to update to the latest firmware, and the new firmware continues to work well with GB.
asafb26 commented 3 weeks ago

@hackoder is the alarm clock works well?

@hackoder is the alarm clock works well?
dakhnod commented 3 weeks ago
Collaborator

@asafb26 last time I checked alarms worked

@asafb26 last time I checked alarms worked
ashimokawa commented 3 weeks ago
Owner

@hackoder

Sorry for duplicating the work, maybe the commit can serve a blueprint for further changes.

So the process is

  1. Add a new option to an xml file, make it fine grained to make it reusable if it is not strictly device specific.

  2. Add it to public int[] getSupportedDeviceSpecificSettings(GBDevice device) in the Coordinator class if 1 has been done in a new xml, if done in the device's main xml skip this step

  3. add the handler to DeviceSpecificSettingsFragment.java (addPreferenceHandlerFor())

  4. react in onSendConfiguration() in the device support class to make changes effective immediately when togging.

(This should go to the wiki with a concrete example)

@hackoder Sorry for duplicating the work, maybe the commit can serve a blueprint for further changes. So the process is 1. Add a new option to an xml file, make it fine grained to make it reusable if it is not strictly device specific. 2. Add it to public int[] getSupportedDeviceSpecificSettings(GBDevice device) in the Coordinator class if 1 has been done in a new xml, if done in the device's main xml skip this step 3. add the handler to DeviceSpecificSettingsFragment.java (addPreferenceHandlerFor()) 4. react in onSendConfiguration() in the device support class to make changes effective immediately when togging. (This should go to the wiki with a concrete example)
hackoder commented 5 days ago

@ashimokawa Does the music app work as expected for you? I can get the controls (next, prev, play, pause) to work correctly, however the currently playing info as well as current state (play/paused) doesn't seem to be sent to the watch yet. Is that correct or just an issue with my configuration?

@ashimokawa Does the music app work as expected for you? I can get the controls (next, prev, play, pause) to work correctly, however the currently playing info as well as current state (play/paused) doesn't seem to be sent to the watch yet. Is that correct or just an issue with my configuration?
dakhnod commented 5 days ago
Collaborator

@hackoder I just tested that, and after removing Spotify from the notification blacklist music info worked.

@ashimokawa maybe we should ignore notification blacklists when dealing with music info?

@hackoder I just tested that, and after removing Spotify from the notification blacklist music info worked. @ashimokawa maybe we should ignore notification blacklists when dealing with music info?
hackoder commented 5 days ago

Yup, removing from notification blacklist fixes it. Nice!

Yup, removing from notification blacklist fixes it. Nice!
Sign in to join this conversation.
No Milestone
No Assignees
7 Participants
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
Cancel
Save
There is no content yet.