Linux bluetooth development
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [RFCv1 08/15] Bluetooth: AMP: Send EFS Conf Rsp when loglink cmpl
Date: Tue,  4 Sep 2012 16:44:27 +0300	[thread overview]
Message-ID: <1346766274-21612-9-git-send-email-Andrei.Emeltchenko.news@gmail.com> (raw)
In-Reply-To: <1346766274-21612-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

After receiving HCI Logical Link Complete event send
L2CAP Configuration Response.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/l2cap.h |    1 +
 net/bluetooth/hci_event.c     |   22 ++++++++++++++++++++++
 net/bluetooth/l2cap_core.c    |   14 ++++++++++++++
 3 files changed, 37 insertions(+)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 3ec8679..064be7f 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -777,5 +777,6 @@ void l2cap_conn_set_timer(struct l2cap_conn *conn, struct delayed_work *work,
 bool l2cap_conn_clear_timer(struct l2cap_conn *conn,
 			    struct delayed_work *work);
 void l2cap_send_conn_req(struct l2cap_chan *chan);
+void l2cap_finish_efs_config(struct l2cap_chan *chan);
 
 #endif /* __L2CAP_H */
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 00387aa..a4b2f1d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3493,12 +3493,34 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev,
 static void hci_loglink_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	struct hci_ev_logical_link_complete *ev = (void *) skb->data;
+	struct hci_conn *hcon;
+	struct hci_chan *hchan;
+	struct amp_mgr *mgr;
 
 	BT_DBG("%s log_handle 0x%4.4x phy_handle 0x%2.2x status 0x%2.2x",
 	       hdev->name, le16_to_cpu(ev->handle), ev->phy_handle,
 	       ev->status);
 
 	/* Return Config Rsp with success */
+	hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle);
+	if (!hcon)
+		return;
+
+	/* Create AMP hchan */
+	hchan = hci_chan_create(hcon);
+	if (!hchan)
+		return;
+
+	hchan->handle = le16_to_cpu(ev->handle);
+
+	BT_DBG("hcon %p mgr %p hchan %p", hcon, hcon->phy_link->mgr, hchan);
+
+	mgr = hcon->phy_link->mgr;
+	if (mgr) {
+		struct l2cap_chan *bredr_chan = mgr->bredr_chan;
+
+		l2cap_finish_efs_config(bredr_chan);
+	}
 }
 
 static void hci_disconn_loglink_complete_evt(struct hci_dev *hdev,
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 609a4cd..c662344 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3647,6 +3647,20 @@ static void l2cap_send_efs_conf_rsp(struct l2cap_chan *chan, void *data,
 					    L2CAP_CONF_SUCCESS, flags), data);
 }
 
+void l2cap_finish_efs_config(struct l2cap_chan *chan)
+{
+	char buf[64];
+
+	BT_DBG("chan %p", chan);
+
+	/* Init also BR/EDR chan */
+	l2cap_ertm_init(chan);
+
+	l2cap_send_efs_conf_rsp(chan, buf, chan->ident, 0);
+
+	l2cap_chan_ready(chan);
+}
+
 static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data)
 {
 	struct l2cap_conf_req *req = (struct l2cap_conf_req *) data;
-- 
1.7.9.5


  parent reply	other threads:[~2012-09-04 13:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 13:44 [RFCv1 00/15] AMP Logical Link setup Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 01/15] Bluetooth: Set Exended Flowspec flag for HS chan Andrei Emeltchenko
2012-09-10 23:49   ` Mat Martineau
2012-09-11  8:15     ` Andrei Emeltchenko
2012-09-11 20:23       ` Mat Martineau
2012-09-04 13:44 ` [RFCv1 02/15] Bluetooth: Add logical link create function Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 03/15] Bluetooth: AMP: Process Logical Link Complete event Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 04/15] Bluetooth: AMP: Add handle to hci_chan structure Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 05/15] Bluetooth: AMP: Process Disc Logical Link Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 06/15] Bluetooth: AMP: Process Disc Physical Link Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 07/15] Bluetooth: L2CAP: Create Conf Response function Andrei Emeltchenko
2012-09-04 13:44 ` Andrei Emeltchenko [this message]
2012-09-04 13:44 ` [RFCv1 09/15] Bluetooth: AMP: Add hs_hchan and hs_hcon to l2cap_chan Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 10/15] Bluetooth: AMP: Handle AMP_LINK connection Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 11/15] Bluetooth: AMP: Send data over AMP channel Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 12/15] Bluetooth: Factor out hci_queue_acl Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 13/15] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 14/15] Bluetooth: Process create response and connect response identically Andrei Emeltchenko
2012-09-04 13:44 ` [RFCv1 15/15] Bluetooth: Factor out common L2CAP connection code Andrei Emeltchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1346766274-21612-9-git-send-email-Andrei.Emeltchenko.news@gmail.com \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox