Bluetooth: Fix address type use for passive scanning

This fix using incorrect address type for passive scanning with
privacy enabled. Controller was not reporting directed advertising
to RPA address due to public type being used for passive scan.

This was affecting TC_CONN_GCEP_BV_01_C, TC_CONN_ACEP_BV_01_C and
TC_CONN_DCEP_BV_01_C qualification test cases.

Jira: ZEP-1200

Change-Id: Icc316441fcac1a72d75f9ade27a99030efc846b9
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This commit is contained in:
Szymon Janc 2016-11-15 13:55:31 +01:00 committed by Johan Hedberg
commit a2ee111aa0

View file

@ -2466,14 +2466,18 @@ static int start_le_scan(uint8_t scan_type, uint16_t interval, uint16_t window,
set_param->window = sys_cpu_to_le16(window);
set_param->filter_policy = 0x00;
if (scan_type == BT_HCI_LE_SCAN_ACTIVE) {
#if defined(CONFIG_BLUETOOTH_PRIVACY)
err = le_set_rpa();
if (err) {
net_buf_unref(buf);
return err;
}
err = le_set_rpa();
if (err) {
net_buf_unref(buf);
return err;
}
set_param->addr_type = BT_ADDR_LE_RANDOM;
#else
set_param->addr_type = bt_dev.id_addr.type;
if (scan_type == BT_HCI_LE_SCAN_ACTIVE) {
/* only set NRPA if there is no advertising ongoing */
if (!atomic_test_bit(bt_dev.flags, BT_DEV_ADVERTISING)) {
err = le_set_nrpa();
@ -2481,13 +2485,11 @@ static int start_le_scan(uint8_t scan_type, uint16_t interval, uint16_t window,
net_buf_unref(buf);
return err;
}
}
#endif
set_param->addr_type = BT_ADDR_LE_RANDOM;
} else {
set_param->addr_type = BT_ADDR_LE_PUBLIC;
set_param->addr_type = BT_ADDR_LE_RANDOM;
}
}
#endif
bt_hci_cmd_send(BT_HCI_OP_LE_SET_SCAN_PARAMS, buf);
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_SCAN_ENABLE,