This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

troubles with device_manager_peripheral.c in sdk 7.0.1

I've been working with SDK 7.0.1 and it seems there are some issues with device_manager_peripheral.c.

First off it doesn't compile out of the box, the debug code is turned on by default but the debug code is for an earlier version:

Things like:

m_peer_table[index].peer_addr.addr[0]

That really should be:

m_peer_table[index].peer_id.id_addr_info.addr[0]

In the handling of BLE_GAP_EVT_AUTH_STATUS, it seems like m_peer_table should be index with device_index and not index. Index is for multiple connections, device_index is for difference devices. There was a blog post about this issue along with a fix, looks like the fix didn't fully make it into 7.0.1.

I changed:

if (p_ble_evt->evt.gap_evt.params.auth_status.central_kex.irk == 1)
{
    m_peer_table[index].peer_id.id_info =
        p_ble_evt->evt.gap_evt.params.auth_status.central_keys.irk;
    m_peer_table[index].id_bitmap &= (~IRK_ENTRY);
}

to:

if (p_ble_evt->evt.gap_evt.params.auth_status.central_kex.irk == 1)
{
    m_peer_table[device_index].peer_id.id_info =
        p_ble_evt->evt.gap_evt.params.auth_status.central_keys.irk;
    m_peer_table[device_index].id_bitmap &= (~IRK_ENTRY);
}

I also added:

if (p_ble_evt->evt.gap_evt.params.auth_status.central_kex.address == 1)
{
    m_peer_table[device_index].peer_id.id_addr_info =
        p_ble_evt->evt.gap_evt.params.auth_status.central_keys.id_info;
    m_peer_table[device_index].id_bitmap &= (~ADDR_ENTRY);
}

But I'm not sure if this last bit is needed or wanted.

With the above changes I can do a mitm bonded connection with both iOS and Android and I don't loose the bond data for multiple devices.

Is this the correct 7.0.1 fix for the multiple devices issue?

Parents Reply Children
No Data
Related