Page 1 of 1

Need to Change line 4470 in bta_dm_act.c

Posted: Wed Mar 29, 2017 3:02 pm
by jesseb
There is a small bug in the bluetooth code when setting a random address. Line 4470 of bta_dm_act.c needs to be changed to UINT8 len = sizeof(p_data->set_addr.address); . It was previously UINT8 len = sizeof(p_data->set_addr); .

Thanks!

Re: Need to Change line 4470 in bta_dm_act.c

Posted: Wed Mar 29, 2017 3:12 pm
by rudi ;-)
jesseb wrote:There is a small bug in the bluetooth code when setting a random address. Line 4470 of bta_dm_act.c needs to be changed to UINT8 len = sizeof(p_data->set_addr.address); . It was previously UINT8 len = sizeof(p_data->set_addr); .

Thanks!
thanks
you mean this line in code`?

Code: Select all



/*******************************************************************************
**
** Function         bta_dm_ble_set_rand_address
**
** Description      This function set the LE random address for the device.
**
** Parameters:      rand_addr:the random address whitch should be setting
** Explanation:     This function added by Yulong at 2016/9/9
*******************************************************************************/
void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data)
{
    UINT8 len = sizeof(p_data->set_addr);
    if (len != BD_ADDR_LEN) {
        APPL_TRACE_ERROR("Invalid random adress");
        return;
    }
    if (p_data->set_addr.addr_type != BLE_ADDR_RANDOM) {
        APPL_TRACE_ERROR("Invalid random adress type = %d\n", p_data->set_addr.addr_type);
        return;
    }
    //send the setting random address to BTM layer
    BTM_BleSetRandAddress(p_data->set_addr.address);

}



best wishes
rudi ;-)


edit: recursively

BD_ADDR_LEN = 6
BD_ADDR_LEN = 6
p_data->set_addr
BD_ADDR address
BD_ADDR

Code: Select all


#define BD_ADDR_LEN     6                   /* Device address length */
typedef UINT8 BD_ADDR[BD_ADDR_LEN];         /* Device address */
typedef UINT8 *BD_ADDR_PTR;                 /* Pointer to Device Address */
good catch!

edit: PR

Re: Need to Change line 4470 in bta_dm_act.c

Posted: Thu Mar 30, 2017 2:18 pm
by jesseb
Yep, that's it. Thanks again!