aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-11-20 10:16:19 -0500
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-11-20 12:54:15 -0500
commit62748ca16f2f79a62d90fb45963233fb10f726c4 (patch)
tree99b8006b2ce6105bb8a2c1ed6a5b8668d34dfa7f /net/bluetooth
parentd1244adc4281eb983a7f41b753164233a7b16b55 (diff)
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)
4517static void l2cap_do_create(struct l2cap_chan *chan, int result, 4517static void l2cap_do_create(struct l2cap_chan *chan, int result,
4518 u8 local_amp_id, u8 remote_amp_id) 4518 u8 local_amp_id, u8 remote_amp_id)
4519{ 4519{
4520 BT_DBG("chan %p state %s %u -> %u", chan, state_to_string(chan->state),
4521 local_amp_id, remote_amp_id);
4522
4520 chan->fcs = L2CAP_FCS_NONE; 4523 chan->fcs = L2CAP_FCS_NONE;
4521 4524
4522 if (!test_bit(CONF_CONNECT_PEND, &chan->conf_state)) { 4525 /* Outgoing channel on AMP */
4526 if (chan->state == BT_CONNECT) {
4527 if (result == L2CAP_CR_SUCCESS) {
4528 chan->local_amp_id = local_amp_id;
4529 l2cap_send_create_chan_req(chan, remote_amp_id);
4530 } else {
4531 /* Revert to BR/EDR connect */
4532 l2cap_send_conn_req(chan);
4533 }
4534
4535 return;
4536 }
4537
4538 /* Incoming channel on AMP */
4539 if (__l2cap_no_conn_pending(chan)) {
4523 struct l2cap_conn_rsp rsp; 4540 struct l2cap_conn_rsp rsp;
4524 char buf[128]; 4541 char buf[128];
4525 rsp.scid = cpu_to_le16(chan->dcid); 4542 rsp.scid = cpu_to_le16(chan->dcid);
4526 rsp.dcid = cpu_to_le16(chan->scid); 4543 rsp.dcid = cpu_to_le16(chan->scid);
4527 4544
4528 /* Incoming channel on AMP */
4529 if (result == L2CAP_CR_SUCCESS) { 4545 if (result == L2CAP_CR_SUCCESS) {
4530 /* Send successful response */ 4546 /* Send successful response */
4531 rsp.result = __constant_cpu_to_le16(L2CAP_CR_SUCCESS); 4547 rsp.result = __constant_cpu_to_le16(L2CAP_CR_SUCCESS);
@@ -4547,15 +4563,6 @@ static void l2cap_do_create(struct l2cap_chan *chan, int result,
4547 l2cap_build_conf_req(chan, buf), buf); 4563 l2cap_build_conf_req(chan, buf), buf);
4548 chan->num_conf_req++; 4564 chan->num_conf_req++;
4549 } 4565 }
4550 } else {
4551 /* Outgoing channel on AMP */
4552 if (result == L2CAP_CR_SUCCESS) {
4553 chan->local_amp_id = local_amp_id;
4554 l2cap_send_create_chan_req(chan, remote_amp_id);
4555 } else {
4556 /* Revert to BR/EDR connect */
4557 l2cap_send_conn_req(chan);
4558 }
4559 } 4566 }
4560} 4567}
4561 4568