summaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-11-20 17:16:19 +0200
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-11-20 15:54:15 -0200
commit62748ca16f2f79a62d90fb45963233fb10f726c4 (patch)
tree99b8006b2ce6105bb8a2c1ed6a5b8668d34dfa7f /net/bluetooth
parentd1244adc4281eb983a7f41b753164233a7b16b55 (diff)
downloadlinux-62748ca16f2f79a62d90fb45963233fb10f726c4.tar.gz
linux-62748ca16f2f79a62d90fb45963233fb10f726c4.tar.bz2
linux-62748ca16f2f79a62d90fb45963233fb10f726c4.zip
Bluetooth: Fix sending L2CAP Create Chan Req
When receiving Physical Link Completed event we need to create L2CAP channel with L2CAP Create Chan Request. Current code was sending this command only if connection was pending (which is probably needed in channel move case). If channel is not moved but created Create Chan should be sent for outgoing channel which is checked with BT_CONNECT flag. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/l2cap_core.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 3ed93938370a..7114bdff5958 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4517,15 +4517,31 @@ void l2cap_move_start(struct l2cap_chan *chan)
static void l2cap_do_create(struct l2cap_chan *chan, int result,
u8 local_amp_id, u8 remote_amp_id)
{
+ BT_DBG("chan %p state %s %u -> %u", chan, state_to_string(chan->state),
+ local_amp_id, remote_amp_id);
+
chan->fcs = L2CAP_FCS_NONE;
- if (!test_bit(CONF_CONNECT_PEND, &chan->conf_state)) {
+ /* Outgoing channel on AMP */
+ if (chan->state == BT_CONNECT) {
+ if (result == L2CAP_CR_SUCCESS) {
+ chan->local_amp_id = local_amp_id;
+ l2cap_send_create_chan_req(chan, remote_amp_id);
+ } else {
+ /* Revert to BR/EDR connect */
+ l2cap_send_conn_req(chan);
+ }
+
+ return;
+ }
+
+ /* Incoming channel on AMP */
+ if (__l2cap_no_conn_pending(chan)) {
struct l2cap_conn_rsp rsp;
char buf[128];
rsp.scid = cpu_to_le16(chan->dcid);
rsp.dcid = cpu_to_le16(chan->scid);
- /* Incoming channel on AMP */
if (result == L2CAP_CR_SUCCESS) {
/* Send successful response */
rsp.result = __constant_cpu_to_le16(L2CAP_CR_SUCCESS);
@@ -4547,15 +4563,6 @@ static void l2cap_do_create(struct l2cap_chan *chan, int result,
l2cap_build_conf_req(chan, buf), buf);
chan->num_conf_req++;
}
- } else {
- /* Outgoing channel on AMP */
- if (result == L2CAP_CR_SUCCESS) {
- chan->local_amp_id = local_amp_id;
- l2cap_send_create_chan_req(chan, remote_amp_id);
- } else {
- /* Revert to BR/EDR connect */
- l2cap_send_conn_req(chan);
- }
}
}