@@ -428,7 +428,7 @@ static void __hci_update_background_scan(struct hci_request *req)
428
428
if (!hci_dev_test_flag (hdev , HCI_LE_SCAN ))
429
429
return ;
430
430
431
- hci_req_add_le_scan_disable (req );
431
+ hci_req_add_le_scan_disable (req , false );
432
432
433
433
BT_DBG ("%s stopping background scanning" , hdev -> name );
434
434
} else {
@@ -447,7 +447,7 @@ static void __hci_update_background_scan(struct hci_request *req)
447
447
* don't miss any advertising (due to duplicates filter).
448
448
*/
449
449
if (hci_dev_test_flag (hdev , HCI_LE_SCAN ))
450
- hci_req_add_le_scan_disable (req );
450
+ hci_req_add_le_scan_disable (req , false );
451
451
452
452
hci_req_add_le_passive_scan (req );
453
453
@@ -652,7 +652,7 @@ void __hci_req_update_eir(struct hci_request *req)
652
652
hci_req_add (req , HCI_OP_WRITE_EIR , sizeof (cp ), & cp );
653
653
}
654
654
655
- void hci_req_add_le_scan_disable (struct hci_request * req )
655
+ void hci_req_add_le_scan_disable (struct hci_request * req , bool rpa_le_conn )
656
656
{
657
657
struct hci_dev * hdev = req -> hdev ;
658
658
@@ -676,8 +676,9 @@ void hci_req_add_le_scan_disable(struct hci_request *req)
676
676
hci_req_add (req , HCI_OP_LE_SET_SCAN_ENABLE , sizeof (cp ), & cp );
677
677
}
678
678
679
+ /* Disable address resolution */
679
680
if (use_ll_privacy (hdev ) &&
680
- hci_dev_test_flag (hdev , HCI_LL_RPA_RESOLUTION )) {
681
+ hci_dev_test_flag (hdev , HCI_LL_RPA_RESOLUTION ) && ! rpa_le_conn ) {
681
682
__u8 enable = 0x00 ;
682
683
hci_req_add (req , HCI_OP_LE_SET_ADDR_RESOLV_ENABLE , 1 , & enable );
683
684
}
@@ -1072,7 +1073,7 @@ static void hci_req_config_le_suspend_scan(struct hci_request *req)
1072
1073
{
1073
1074
/* Before changing params disable scan if enabled */
1074
1075
if (hci_dev_test_flag (req -> hdev , HCI_LE_SCAN ))
1075
- hci_req_add_le_scan_disable (req );
1076
+ hci_req_add_le_scan_disable (req , false );
1076
1077
1077
1078
/* Configure params and enable scanning */
1078
1079
hci_req_add_le_passive_scan (req );
@@ -1140,7 +1141,7 @@ void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next)
1140
1141
1141
1142
/* Disable LE passive scan if enabled */
1142
1143
if (hci_dev_test_flag (hdev , HCI_LE_SCAN ))
1143
- hci_req_add_le_scan_disable (& req );
1144
+ hci_req_add_le_scan_disable (& req , false );
1144
1145
1145
1146
/* Mark task needing completion */
1146
1147
set_bit (SUSPEND_SCAN_DISABLE , hdev -> suspend_tasks );
@@ -1696,6 +1697,28 @@ int hci_req_update_adv_data(struct hci_dev *hdev, u8 instance)
1696
1697
return hci_req_run (& req , NULL );
1697
1698
}
1698
1699
1700
+ static void enable_addr_resolution_complete (struct hci_dev * hdev , u8 status ,
1701
+ u16 opcode )
1702
+ {
1703
+ BT_DBG ("%s status %u" , hdev -> name , status );
1704
+ }
1705
+
1706
+ void hci_req_disable_address_resolution (struct hci_dev * hdev )
1707
+ {
1708
+ struct hci_request req ;
1709
+ __u8 enable = 0x00 ;
1710
+
1711
+ if (!use_ll_privacy (hdev ) &&
1712
+ !hci_dev_test_flag (hdev , HCI_LL_RPA_RESOLUTION ))
1713
+ return ;
1714
+
1715
+ hci_req_init (& req , hdev );
1716
+
1717
+ hci_req_add (& req , HCI_OP_LE_SET_ADDR_RESOLV_ENABLE , 1 , & enable );
1718
+
1719
+ hci_req_run (& req , enable_addr_resolution_complete );
1720
+ }
1721
+
1699
1722
static void adv_enable_complete (struct hci_dev * hdev , u8 status , u16 opcode )
1700
1723
{
1701
1724
BT_DBG ("%s status %u" , hdev -> name , status );
@@ -2667,7 +2690,7 @@ static void bg_scan_update(struct work_struct *work)
2667
2690
2668
2691
static int le_scan_disable (struct hci_request * req , unsigned long opt )
2669
2692
{
2670
- hci_req_add_le_scan_disable (req );
2693
+ hci_req_add_le_scan_disable (req , false );
2671
2694
return 0 ;
2672
2695
}
2673
2696
@@ -2770,7 +2793,7 @@ static int le_scan_restart(struct hci_request *req, unsigned long opt)
2770
2793
return 0 ;
2771
2794
}
2772
2795
2773
- hci_req_add_le_scan_disable (req );
2796
+ hci_req_add_le_scan_disable (req , false );
2774
2797
2775
2798
if (use_ext_scan (hdev )) {
2776
2799
struct hci_cp_le_set_ext_scan_enable ext_enable_cp ;
@@ -2861,7 +2884,7 @@ static int active_scan(struct hci_request *req, unsigned long opt)
2861
2884
* discovery scanning parameters.
2862
2885
*/
2863
2886
if (hci_dev_test_flag (hdev , HCI_LE_SCAN ))
2864
- hci_req_add_le_scan_disable (req );
2887
+ hci_req_add_le_scan_disable (req , false );
2865
2888
2866
2889
/* All active scans will be done with either a resolvable private
2867
2890
* address (when privacy feature has been enabled) or non-resolvable
@@ -2976,14 +2999,14 @@ bool hci_req_stop_discovery(struct hci_request *req)
2976
2999
2977
3000
if (hci_dev_test_flag (hdev , HCI_LE_SCAN )) {
2978
3001
cancel_delayed_work (& hdev -> le_scan_disable );
2979
- hci_req_add_le_scan_disable (req );
3002
+ hci_req_add_le_scan_disable (req , false );
2980
3003
}
2981
3004
2982
3005
ret = true;
2983
3006
} else {
2984
3007
/* Passive scanning */
2985
3008
if (hci_dev_test_flag (hdev , HCI_LE_SCAN )) {
2986
- hci_req_add_le_scan_disable (req );
3009
+ hci_req_add_le_scan_disable (req , false );
2987
3010
ret = true;
2988
3011
}
2989
3012
}
0 commit comments