diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-10-25 16:20:44 +0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-11-02 02:27:02 +0400 |
commit | d5e911928bd8325918bda3df59e84b0c17a0cdab (patch) | |
tree | 69dfd05dd7b445630683679271d7bdddb56c76af | |
parent | 35ba9561b9b5dc1e5921b927440bd6d3844f0577 (diff) | |
download | linux-d5e911928bd8325918bda3df59e84b0c17a0cdab.tar.xz |
Bluetooth: AMP: Process Physical Link Complete evt
Add processing for HCI Physical Link Complete event. Upon
successful status received start L2CAP create channel process.
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>
-rw-r--r-- | net/bluetooth/hci_event.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index dc60d3161824..d2c45591f06d 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3644,6 +3644,57 @@ unlock: hci_dev_unlock(hdev); } +static void hci_phy_link_complete_evt(struct hci_dev *hdev, + struct sk_buff *skb) +{ + struct hci_ev_phy_link_complete *ev = (void *) skb->data; + struct hci_conn *hcon, *bredr_hcon; + + BT_DBG("%s handle 0x%2.2x status 0x%2.2x", hdev->name, ev->phy_handle, + ev->status); + + hci_dev_lock(hdev); + + hcon = hci_conn_hash_lookup_handle(hdev, ev->phy_handle); + if (!hcon) { + hci_dev_unlock(hdev); + return; + } + + if (ev->status) { + hci_conn_del(hcon); + hci_dev_unlock(hdev); + return; + } + + bredr_hcon = hcon->amp_mgr->l2cap_conn->hcon; + + hcon->state = BT_CONNECTED; + bacpy(&hcon->dst, &bredr_hcon->dst); + + hci_conn_hold(hcon); + hcon->disc_timeout = HCI_DISCONN_TIMEOUT; + hci_conn_put(hcon); + + hci_conn_hold_device(hcon); + hci_conn_add_sysfs(hcon); + + hci_dev_unlock(hdev); + + if (hcon->out) { + struct hci_dev *bredr_hdev = hci_dev_hold(bredr_hcon->hdev); + + if (!bredr_hdev) + return; + + /* Placeholder - create chan req + l2cap_chan_create_cfm(bredr_hcon, hcon->remote_id); + */ + + hci_dev_put(bredr_hdev); + } +} + static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_ev_le_conn_complete *ev = (void *) skb->data; @@ -3971,6 +4022,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) hci_remote_oob_data_request_evt(hdev, skb); break; + case HCI_EV_PHY_LINK_COMPLETE: + hci_phy_link_complete_evt(hdev, skb); + break; + case HCI_EV_NUM_COMP_BLOCKS: hci_num_comp_blocks_evt(hdev, skb); break; |