@@ -752,7 +752,6 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
752
752
struct hci_conn * conn ,
753
753
bdaddr_t * direct_rpa )
754
754
{
755
- struct hci_cp_le_create_conn cp ;
756
755
struct hci_dev * hdev = conn -> hdev ;
757
756
u8 own_addr_type ;
758
757
@@ -775,25 +774,62 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
775
774
return ;
776
775
}
777
776
778
- memset (& cp , 0 , sizeof (cp ));
777
+ if (use_ext_conn (hdev )) {
778
+ struct hci_cp_le_ext_create_conn * cp ;
779
+ struct hci_cp_le_ext_conn_param * p ;
780
+ /* As of now only LE 1M is supported */
781
+ u8 data [sizeof (* cp ) + sizeof (* p ) * 1 ];
779
782
780
- /* Set window to be the same value as the interval to enable
781
- * continuous scanning.
782
- */
783
- cp .scan_interval = cpu_to_le16 (hdev -> le_scan_interval );
784
- cp .scan_window = cp .scan_interval ;
783
+ cp = (void * ) data ;
784
+ p = (void * ) cp -> data ;
785
785
786
- bacpy (& cp .peer_addr , & conn -> dst );
787
- cp .peer_addr_type = conn -> dst_type ;
788
- cp .own_address_type = own_addr_type ;
789
- cp .conn_interval_min = cpu_to_le16 (conn -> le_conn_min_interval );
790
- cp .conn_interval_max = cpu_to_le16 (conn -> le_conn_max_interval );
791
- cp .conn_latency = cpu_to_le16 (conn -> le_conn_latency );
792
- cp .supervision_timeout = cpu_to_le16 (conn -> le_supv_timeout );
793
- cp .min_ce_len = cpu_to_le16 (0x0000 );
794
- cp .max_ce_len = cpu_to_le16 (0x0000 );
795
-
796
- hci_req_add (req , HCI_OP_LE_CREATE_CONN , sizeof (cp ), & cp );
786
+ memset (cp , 0 , sizeof (* cp ));
787
+
788
+ bacpy (& cp -> peer_addr , & conn -> dst );
789
+ cp -> peer_addr_type = conn -> dst_type ;
790
+ cp -> own_addr_type = own_addr_type ;
791
+ cp -> phys = LE_SCAN_PHY_1M ;
792
+
793
+ memset (p , 0 , sizeof (* p ));
794
+
795
+ /* Set window to be the same value as the interval to enable
796
+ * continuous scanning.
797
+ */
798
+
799
+ p -> scan_interval = cpu_to_le16 (hdev -> le_scan_interval );
800
+ p -> scan_window = p -> scan_interval ;
801
+ p -> conn_interval_min = cpu_to_le16 (conn -> le_conn_min_interval );
802
+ p -> conn_interval_max = cpu_to_le16 (conn -> le_conn_max_interval );
803
+ p -> conn_latency = cpu_to_le16 (conn -> le_conn_latency );
804
+ p -> supervision_timeout = cpu_to_le16 (conn -> le_supv_timeout );
805
+ p -> min_ce_len = cpu_to_le16 (0x0000 );
806
+ p -> max_ce_len = cpu_to_le16 (0x0000 );
807
+
808
+ hci_req_add (req , HCI_OP_LE_EXT_CREATE_CONN , sizeof (data ), data );
809
+
810
+ } else {
811
+ struct hci_cp_le_create_conn cp ;
812
+
813
+ memset (& cp , 0 , sizeof (cp ));
814
+
815
+ /* Set window to be the same value as the interval to enable
816
+ * continuous scanning.
817
+ */
818
+ cp .scan_interval = cpu_to_le16 (hdev -> le_scan_interval );
819
+ cp .scan_window = cp .scan_interval ;
820
+
821
+ bacpy (& cp .peer_addr , & conn -> dst );
822
+ cp .peer_addr_type = conn -> dst_type ;
823
+ cp .own_address_type = own_addr_type ;
824
+ cp .conn_interval_min = cpu_to_le16 (conn -> le_conn_min_interval );
825
+ cp .conn_interval_max = cpu_to_le16 (conn -> le_conn_max_interval );
826
+ cp .conn_latency = cpu_to_le16 (conn -> le_conn_latency );
827
+ cp .supervision_timeout = cpu_to_le16 (conn -> le_supv_timeout );
828
+ cp .min_ce_len = cpu_to_le16 (0x0000 );
829
+ cp .max_ce_len = cpu_to_le16 (0x0000 );
830
+
831
+ hci_req_add (req , HCI_OP_LE_CREATE_CONN , sizeof (cp ), & cp );
832
+ }
797
833
798
834
conn -> state = BT_CONNECT ;
799
835
clear_bit (HCI_CONN_SCANNING , & conn -> flags );
0 commit comments