Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb8a1e1f authored by Mallikarjuna GB's avatar Mallikarjuna GB Committed by Andre Eisenbach
Browse files

Initialize btif_max_hf_clients with proper value

btif_max_hf_clients which is an unsigned 16bit integer is
initialized with -1(0xFFFF) in btif_hf.c. Later on, when
application calls init with max_hf_clients as 1, btif_max_hf_clients
will be set to 1. But, before this happens, context switch happened
from application context to btif context with btif_max_hf_clients as -1.
In the btif context, BTA_AgRegister gets called in for loop for 0xFFFF
times. We are running out of scbs due to this.
Initialize btif_max_hf_clients with 1. Assign it to max_hf_clients
before context switch happens.

Change-Id: Ibde1bebbab2eb64442027164236f1d82e4269d23
parent bf8c5189
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -94,7 +94,7 @@
#define BTIF_HF_NUM_CB       2
#define BTIF_HF_NUM_CB       2


/* Max HF clients supported from App */
/* Max HF clients supported from App */
UINT16 btif_max_hf_clients = -1;
UINT16 btif_max_hf_clients = 1;


/* HF app ids for service registration */
/* HF app ids for service registration */
typedef enum {
typedef enum {
@@ -716,6 +716,10 @@ static bt_status_t init( bthf_callbacks_t* callbacks, int max_hf_clients)
    bt_hf_callbacks = callbacks;
    bt_hf_callbacks = callbacks;
    memset(&btif_hf_cb, 0, sizeof(btif_hf_cb));
    memset(&btif_hf_cb, 0, sizeof(btif_hf_cb));


    memset(&btif_hf_cb, 0, sizeof(btif_hf_cb));
    btif_max_hf_clients = max_hf_clients;
    BTIF_TRACE_DEBUG("btif_max_hf_clients = %d", btif_max_hf_clients);

    /* Invoke the enable service API to the core to set the appropriate service_id
    /* Invoke the enable service API to the core to set the appropriate service_id
     * Internally, the HSP_SERVICE_ID shall also be enabled if HFP is enabled (phone)
     * Internally, the HSP_SERVICE_ID shall also be enabled if HFP is enabled (phone)
     * othwerwise only HSP is enabled (tablet)
     * othwerwise only HSP is enabled (tablet)