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

BLE bond deleted after 2 reboots without connectivity to central #2093

Open
1 task done
DavisNT opened this issue Jul 8, 2024 · 3 comments
Open
1 task done

BLE bond deleted after 2 reboots without connectivity to central #2093

DavisNT opened this issue Jul 8, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@DavisNT
Copy link

DavisNT commented Jul 8, 2024

Verification

  • I searched for similar bug reports (including closed issues) and found none was relevant.

What happened?

After 2 reboots bond was deleted

What should happen instead?

Bond is preserved after any number of reboots

Reproduction steps

  1. Turn off bluetooth on the central (phone etc.)
  2. Reboot PineTime
  3. Reboot PineTime
  4. Bond now is deleted on the watch

More details?

This behavior is counter-intuitive and likely most InfiniTime users are not aware of this behavior.
Likely this might also have negative impact on security - at least some companion apps (e.g. Gadgetbridge 0.79) will continue to function as before after the bond is deleted on the watch (whether any encrypted pairing is done in this case or all data is transferred unencrypted is an open question).

This is by design (see #796 and 51f62ad ), but why the bond is removed after 2 reboots?
Does existence of the bond have any negative effects? Maybe this could/should be converted into a button under Bluetooth settings (or something like that)?
@evergreen22 Thanks for the BLE bonding functionality! Maybe you know answers to the questions above?

Version

1.14.0

Companion app

Gadgetbrigle, but this will also apply to others

@DavisNT DavisNT added the bug Something isn't working label Jul 8, 2024
@evergreen22
Copy link
Contributor

"It's not a bug it is a feature"

To clarify your issue report, the bond is only deleted if there are two consecutive reboots without a re-connect to the companion. Each time Infinitime reconnects with the bonded device the "counter" is reset to zero.

Once the watch and companion are bonded no other device may connect to Infinitime (see bluetooth spec - TL;DR Infinitime will not accept a new connection attempt from an unbonded device).

Consider the scenario where Infinitime has bonded but your companion has lost its bond (maybe you deleted them, maybe your bluetooth stack wigged out, maybe venus is rising in scorpio). The only way to re-bond your watch in this case would be to erase the bond using a hardware programmer (at least this was true at the time of #796 - my personal version has diverged quite a bit since then to include full privacy and encryption as well as dozens of personal customizations - I haven't followed Infinitime closely lately)

IMO the bond delete feature/design should definitely be (better) documented behavior.

@DavisNT
Copy link
Author

DavisNT commented Jul 9, 2024

@evergreen22 Thanks for the fast reply!

To clarify your issue report, the bond is only deleted if there are two consecutive reboots without a re-connect to the companion. Each time Infinitime reconnects with the bonded device the "counter" is reset to zero.

Thanks! I know this. 😊

Once the watch and companion are bonded no other device may connect to Infinitime (see bluetooth spec - TL;DR Infinitime will not accept a new connection attempt from an unbonded device).

I don't know whether this was the case at the time of #796, but now this is not the case anymore. I have just tested by removing the watch from Gadgetbridge and adding it again. InfiniTime accepts new pairing/bonding requests from the device with the saved bond, I will hopefully be able to test whether InfiniTime would also accept pairing/bonding requests from other devices.

Also there are many devices (e.g. Bluetooth speakers) that are ready for pairing/bonding whenever the already paired device is disconnected. Are you sure bluetooth spec prohibits repeated pairing/bonding when the bonded device has been disconnected?

Consider the scenario where Infinitime has bonded but your companion has lost its bond (maybe you deleted them, maybe your bluetooth stack wigged out, maybe venus is rising in scorpio). The only way to re-bond your watch in this case would be to erase the bond using a hardware programmer (at least this was true at the time of #796 - my personal version has diverged quite a bit since then to include full privacy and encryption as well as dozens of personal customizations - I haven't followed Infinitime closely lately)

Your personal version sounds very intriguing! Is the source available? Can I port parts from it to the mainline InfiniTime? I am also planning to implement a setting for full Bluetooth privacy and encryption (likely if/after my existing PR for a setting that disables firmware update will be merged). Also your other customizations sound interesting...

@evergreen22
Copy link
Contributor

Sorry I wasn't clear in my previous reply. I was trying to say that Infinitime only supports one connection at a time. Of course, BLE allows multiple devices to be bonded simultaneously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants