OSDN Git Service

Reset the pairing state on pairing failure
authorSrinu Jella <sjella@codeaurora.org>
Mon, 13 Oct 2014 12:36:01 +0000 (18:06 +0530)
committerAndre Eisenbach <eisenbach@google.com>
Tue, 23 Jun 2015 22:18:49 +0000 (15:18 -0700)
Use case: Test the paring scenario with remote device with security mode 3.

STR:
1. Create a connection from Remove dev with Security Mode-3 to DUT.
2. Enter pin key in remote, when pin key pop-up comes in DUT, reject the same.
3. Try to create connection from DUT to Remote dev-2, within 30 seconds.

Failure: Create connection not sent from DUT to remote, even though
there was no pairing taking place

Root cause: As the pairing state is not reset properly it disturbs
the next pairing process.

Reproducible using MecApp test application.

Fix: Reset the pairing state to idle in case stored paring
device matches with the device for which the pairing
failure happened.

Bug: 21896912
Change-Id: I0a9e143a44bb2ae7e296d7d76c1323e517f9cc42

stack/btm/btm_sec.c

index 34770f7..e735299 100644 (file)
@@ -4452,6 +4452,14 @@ void btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode)
         }
         else
         {
+            /* If the device matches with stored paring address
+             * reset the paring state to idle */
+            if ((btm_cb.pairing_state != BTM_PAIR_STATE_IDLE) &&
+                (memcmp (btm_cb.pairing_bda, bda, BD_ADDR_LEN) == 0))
+            {
+                btm_sec_change_pairing_state(BTM_PAIR_STATE_IDLE);
+            }
+
             /* can not find the device record and the status is error,
              * just ignore it */
             return;