aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-09-27 10:26:19 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-09-27 16:30:40 -0400
commita02226d6ff5098e6b97590cc55aabe7faf0860ed (patch)
tree5ec09ebf86af46cdf37ecca872f2cfd12004edb7
parent5a349186692950b13896abc3fb2f491d023f95a1 (diff)
Bluetooth: AMP: Create Physical Link
When receiving A2MP Get AMP Assoc Response execute HCI Create Physical Link to AMP controller. Define function which will run when receiving HCI Command Status. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
-rw-r--r--include/net/bluetooth/amp.h2
-rw-r--r--net/bluetooth/a2mp.c2
-rw-r--r--net/bluetooth/amp.c19
-rw-r--r--net/bluetooth/hci_event.c9
4 files changed, 32 insertions, 0 deletions
diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
index 763b4635c304..cadb3d032856 100644
--- a/include/net/bluetooth/amp.h
+++ b/include/net/bluetooth/amp.h
@@ -37,5 +37,7 @@ int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type);
37void amp_read_loc_info(struct hci_dev *hdev, struct amp_mgr *mgr); 37void amp_read_loc_info(struct hci_dev *hdev, struct amp_mgr *mgr);
38void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle); 38void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle);
39void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr); 39void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr);
40void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
41 struct hci_conn *hcon);
40 42
41#endif /* __AMP_H */ 43#endif /* __AMP_H */
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 93adaad782ed..773e8fc41670 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -392,6 +392,8 @@ static int a2mp_getampassoc_rsp(struct amp_mgr *mgr, struct sk_buff *skb,
392 392
393 BT_DBG("Created hcon %p: loc:%d -> rem:%d", hcon, hdev->id, rsp->id); 393 BT_DBG("Created hcon %p: loc:%d -> rem:%d", hcon, hdev->id, rsp->id);
394 394
395 amp_create_phylink(hdev, mgr, hcon);
396
395done: 397done:
396 hci_dev_put(hdev); 398 hci_dev_put(hdev);
397 skb_pull(skb, len); 399 skb_pull(skb, len);
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 67bc2c2f8783..657ec736bbc6 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -232,3 +232,22 @@ void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr)
232 mgr->state = READ_LOC_AMP_ASSOC; 232 mgr->state = READ_LOC_AMP_ASSOC;
233 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp); 233 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp);
234} 234}
235
236void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
237 struct hci_conn *hcon)
238{
239 struct hci_cp_create_phy_link cp;
240
241 cp.phy_handle = hcon->handle;
242
243 BT_DBG("%s hcon %p phy handle 0x%2.2x", hdev->name, hcon,
244 hcon->handle);
245
246 if (phylink_gen_key(mgr->l2cap_conn->hcon, cp.key, &cp.key_len,
247 &cp.key_type)) {
248 BT_DBG("Cannot create link key");
249 return;
250 }
251
252 hci_send_cmd(hdev, HCI_OP_CREATE_PHY_LINK, sizeof(cp), &cp);
253}
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index a4240f7a142e..bd06ef95693d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1698,6 +1698,11 @@ static void hci_cs_le_start_enc(struct hci_dev *hdev, u8 status)
1698 BT_DBG("%s status 0x%2.2x", hdev->name, status); 1698 BT_DBG("%s status 0x%2.2x", hdev->name, status);
1699} 1699}
1700 1700
1701static void hci_cs_create_phylink(struct hci_dev *hdev, u8 status)
1702{
1703 BT_DBG("%s status 0x%2.2x", hdev->name, status);
1704}
1705
1701static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 1706static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
1702{ 1707{
1703 __u8 status = *((__u8 *) skb->data); 1708 __u8 status = *((__u8 *) skb->data);
@@ -2512,6 +2517,10 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
2512 hci_cs_le_start_enc(hdev, ev->status); 2517 hci_cs_le_start_enc(hdev, ev->status);
2513 break; 2518 break;
2514 2519
2520 case HCI_OP_CREATE_PHY_LINK:
2521 hci_cs_create_phylink(hdev, ev->status);
2522 break;
2523
2515 default: 2524 default:
2516 BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode); 2525 BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode);
2517 break; 2526 break;