@@ -794,10 +794,10 @@ static void hci_set_le_support(struct hci_dev *hdev)
794794
795795 if (test_bit (HCI_LE_ENABLED , & hdev -> dev_flags )) {
796796 cp .le = 1 ;
797- cp .simul = !! lmp_le_br_capable (hdev );
797+ cp .simul = lmp_le_br_capable (hdev );
798798 }
799799
800- if (cp .le != !! lmp_host_le_capable (hdev ))
800+ if (cp .le != lmp_host_le_capable (hdev ))
801801 hci_send_cmd (hdev , HCI_OP_WRITE_LE_HOST_SUPPORTED , sizeof (cp ),
802802 & cp );
803803}
@@ -2047,15 +2047,53 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
20472047 hci_conn_check_pending (hdev );
20482048}
20492049
2050+ void hci_conn_accept (struct hci_conn * conn , int mask )
2051+ {
2052+ struct hci_dev * hdev = conn -> hdev ;
2053+
2054+ BT_DBG ("conn %p" , conn );
2055+
2056+ conn -> state = BT_CONFIG ;
2057+
2058+ if (!lmp_esco_capable (hdev )) {
2059+ struct hci_cp_accept_conn_req cp ;
2060+
2061+ bacpy (& cp .bdaddr , & conn -> dst );
2062+
2063+ if (lmp_rswitch_capable (hdev ) && (mask & HCI_LM_MASTER ))
2064+ cp .role = 0x00 ; /* Become master */
2065+ else
2066+ cp .role = 0x01 ; /* Remain slave */
2067+
2068+ hci_send_cmd (hdev , HCI_OP_ACCEPT_CONN_REQ , sizeof (cp ), & cp );
2069+ } else /* lmp_esco_capable(hdev)) */ {
2070+ struct hci_cp_accept_sync_conn_req cp ;
2071+
2072+ bacpy (& cp .bdaddr , & conn -> dst );
2073+ cp .pkt_type = cpu_to_le16 (conn -> pkt_type );
2074+
2075+ cp .tx_bandwidth = __constant_cpu_to_le32 (0x00001f40 );
2076+ cp .rx_bandwidth = __constant_cpu_to_le32 (0x00001f40 );
2077+ cp .max_latency = __constant_cpu_to_le16 (0xffff );
2078+ cp .content_format = cpu_to_le16 (hdev -> voice_setting );
2079+ cp .retrans_effort = 0xff ;
2080+
2081+ hci_send_cmd (hdev , HCI_OP_ACCEPT_SYNC_CONN_REQ ,
2082+ sizeof (cp ), & cp );
2083+ }
2084+ }
2085+
20502086static void hci_conn_request_evt (struct hci_dev * hdev , struct sk_buff * skb )
20512087{
20522088 struct hci_ev_conn_request * ev = (void * ) skb -> data ;
20532089 int mask = hdev -> link_mode ;
2090+ __u8 flags = 0 ;
20542091
20552092 BT_DBG ("%s bdaddr %pMR type 0x%x" , hdev -> name , & ev -> bdaddr ,
20562093 ev -> link_type );
20572094
2058- mask |= hci_proto_connect_ind (hdev , & ev -> bdaddr , ev -> link_type );
2095+ mask |= hci_proto_connect_ind (hdev , & ev -> bdaddr , ev -> link_type ,
2096+ & flags );
20592097
20602098 if ((mask & HCI_LM_ACCEPT ) &&
20612099 !hci_blacklist_lookup (hdev , & ev -> bdaddr )) {
@@ -2081,12 +2119,13 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
20812119 }
20822120
20832121 memcpy (conn -> dev_class , ev -> dev_class , 3 );
2084- conn -> state = BT_CONNECT ;
20852122
20862123 hci_dev_unlock (hdev );
20872124
2088- if (ev -> link_type == ACL_LINK || !lmp_esco_capable (hdev )) {
2125+ if (ev -> link_type == ACL_LINK ||
2126+ (!(flags & HCI_PROTO_DEFER ) && !lmp_esco_capable (hdev ))) {
20892127 struct hci_cp_accept_conn_req cp ;
2128+ conn -> state = BT_CONNECT ;
20902129
20912130 bacpy (& cp .bdaddr , & ev -> bdaddr );
20922131
@@ -2097,8 +2136,9 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
20972136
20982137 hci_send_cmd (hdev , HCI_OP_ACCEPT_CONN_REQ , sizeof (cp ),
20992138 & cp );
2100- } else {
2139+ } else if (!( flags & HCI_PROTO_DEFER )) {
21012140 struct hci_cp_accept_sync_conn_req cp ;
2141+ conn -> state = BT_CONNECT ;
21022142
21032143 bacpy (& cp .bdaddr , & ev -> bdaddr );
21042144 cp .pkt_type = cpu_to_le16 (conn -> pkt_type );
@@ -2111,6 +2151,10 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
21112151
21122152 hci_send_cmd (hdev , HCI_OP_ACCEPT_SYNC_CONN_REQ ,
21132153 sizeof (cp ), & cp );
2154+ } else {
2155+ conn -> state = BT_CONNECT2 ;
2156+ hci_proto_connect_cfm (conn , 0 );
2157+ hci_conn_put (conn );
21142158 }
21152159 } else {
21162160 /* Connection rejected */
0 commit comments