Return-Path: From: Andrei Emeltchenko To: linux-bluetooth@vger.kernel.org Subject: [PATCHv3 18/19] Bluetooth: AMP: Send Create Chan Req Date: Thu, 6 Sep 2012 15:19:56 +0300 Message-Id: <1346933997-14369-19-git-send-email-Andrei.Emeltchenko.news@gmail.com> In-Reply-To: <1346933997-14369-1-git-send-email-Andrei.Emeltchenko.news@gmail.com> References: <1340981212-21709-1-git-send-email-Andrei.Emeltchenko.news@gmail.com> <1346933997-14369-1-git-send-email-Andrei.Emeltchenko.news@gmail.com> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: From: Andrei Emeltchenko Send L2CAP Create Channel Request when receiving HCI Physical Link Complete event. Signed-off-by: Andrei Emeltchenko --- include/net/bluetooth/hci_core.h | 5 +++++ net/bluetooth/l2cap_core.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index dc7a32e..81fd19c 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -367,6 +367,7 @@ extern void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason); extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt); extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags); +extern void l2cap_chan_create_cfm(struct hci_conn *hcon, u8 status); extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status); @@ -787,6 +788,10 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status) sco_connect_cfm(conn, status); break; + case AMP_LINK: + l2cap_chan_create_cfm(conn, status); + break; + default: BT_ERR("unknown link type %d", conn->type); break; diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index a7a62f6..6487705 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -38,6 +38,7 @@ #include #include #include +#include bool disable_ertm; @@ -1035,6 +1036,21 @@ void l2cap_send_conn_req(struct l2cap_chan *chan) l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_REQ, sizeof(req), &req); } +static void l2cap_send_chan_create_req(struct l2cap_chan *chan, u8 remote_id) +{ + struct l2cap_conn *conn = chan->conn; + struct l2cap_create_chan_req req; + + req.scid = cpu_to_le16(chan->scid); + req.psm = chan->psm; + req.amp_id = remote_id; + + chan->ident = l2cap_get_ident(conn); + + l2cap_send_cmd(conn, chan->ident, L2CAP_CREATE_CHAN_REQ, + sizeof(req), &req); +} + static void l2cap_chan_ready(struct l2cap_chan *chan) { /* This clears all conf flags, including CONF_NOT_COMPLETE */ @@ -5418,7 +5434,13 @@ void l2cap_connect_cfm(struct hci_conn *hcon, u8 status) l2cap_conn_put(conn); } +} + +void l2cap_chan_create_cfm(struct hci_conn *hcon, u8 remote_id) +{ + struct amp_mgr *mgr = hcon->amp_mgr; + l2cap_send_chan_create_req(mgr->bredr_chan, remote_id); } int l2cap_disconn_ind(struct hci_conn *hcon) -- 1.7.9.5