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

Requesting encryption to an already paired device #17

Open
cptQuooker opened this issue Nov 26, 2019 · 0 comments
Open

Requesting encryption to an already paired device #17

cptQuooker opened this issue Nov 26, 2019 · 0 comments

Comments

@cptQuooker
Copy link

In the file esp32_bt_gatts.c, the if-statement on row 453 checks the currently set security level, and then sends an encryption request to the device.

However, this check is not necessary when a device is already paired, correct? The ESP32 should already know the encryption keys when the device is found in the list?

I am currently running into an issue where the bt-common library is fully functional on Android devices when pairing and reconnecting, but not on iOS devices. iOS devices seem to only work when pairing for the first time. At a reconnect, iOS will not trigger the ESP_GAP_BLE_AUTH_CMPL_EVT event (<-- this is assumed, there is no log when the "continue" triggers in line 723).

Adding !is_paired(p->remote_bda) to row 453 in esp32_bt_gatts.c seems to fix this issue, making it effectively: if (sec_act != 0 && !is_paired(p->remote_bda)) {

Is this solving this issue the wrong way? Or is this a bug in esp32_bt_gatts.c? It just does not seem logical to me to request encryption again for an already paired device. With this change, everything now works fine on Android and iOS.

My settings:

  • bt.gatts.min_sec_level = 1
  • bt.gatts.require_pairing = true
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

1 participant