]> granicus.if.org Git - esp-idf/commitdiff
component/bt: Unlock reserve of SCN 1 for HFP (backport v3.1)
authorbaohongde <baohongde@espressif.com>
Mon, 17 Sep 2018 03:01:58 +0000 (11:01 +0800)
committerbaohongde <baohongde@espressif.com>
Mon, 17 Sep 2018 03:01:58 +0000 (11:01 +0800)
A cherry-pick of MR !3269

components/bt/bluedroid/stack/btm/btm_acl.c

index 5bf59c895c1b86b519c1877d897f3b320943d040..3f101c1ba78989bf1ee770005d11abcbd9be1a4c 100644 (file)
@@ -1522,11 +1522,10 @@ UINT8 BTM_AllocateSCN(void)
 {
     UINT8   x;
     BTM_TRACE_DEBUG ("BTM_AllocateSCN\n");
-    // stack reserves scn 1 for HFP, HSP we still do the correct way
     for (x = 1; x < BTM_MAX_SCN; x++) {
-        if (!btm_cb.btm_scn[x]) {
-            btm_cb.btm_scn[x] = TRUE;
-            return (x + 1);
+        if (!btm_cb.btm_scn[x - 1]) {
+            btm_cb.btm_scn[x - 1] = TRUE;
+            return x;
         }
     }
     return (0);    /* No free ports */
@@ -1545,10 +1544,7 @@ UINT8 BTM_AllocateSCN(void)
 #if (CLASSIC_BT_INCLUDED == TRUE)
 BOOLEAN BTM_TryAllocateSCN(UINT8 scn)
 {
-    /* Make sure we don't exceed max port range.
-     * Stack reserves scn 1 for HFP, HSP we still do the correct way.
-     */
-    if ( (scn >= BTM_MAX_SCN) || (scn == 1) ) {
+    if (scn >= BTM_MAX_SCN) {
         return FALSE;
     }