diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-05-29 06:59:14 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-06-04 23:34:13 -0400 |
commit | 6113f84fc1a8962aed25f54a115b196e9aea151f (patch) | |
tree | 0209e8d9aef3d685aab4844f02f24c863bcf29ec /net/bluetooth/a2mp.c | |
parent | e072f5dab22e7bf0a10daf854acc0fc271396ee7 (diff) |
Bluetooth: A2MP: Process A2MP Disc Physlink Request
Placeholder for A2MP Disconnect Physlink Request.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/a2mp.c')
-rw-r--r-- | net/bluetooth/a2mp.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index ca52a91edd29..400696b3b817 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c | |||
@@ -280,6 +280,39 @@ send_rsp: | |||
280 | return 0; | 280 | return 0; |
281 | } | 281 | } |
282 | 282 | ||
283 | static int a2mp_discphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, | ||
284 | struct a2mp_cmd *hdr) | ||
285 | { | ||
286 | struct a2mp_physlink_req *req = (void *) skb->data; | ||
287 | struct a2mp_physlink_rsp rsp; | ||
288 | struct hci_dev *hdev; | ||
289 | |||
290 | if (le16_to_cpu(hdr->len) < sizeof(*req)) | ||
291 | return -EINVAL; | ||
292 | |||
293 | BT_DBG("local_id %d remote_id %d", req->local_id, req->remote_id); | ||
294 | |||
295 | rsp.local_id = req->remote_id; | ||
296 | rsp.remote_id = req->local_id; | ||
297 | rsp.status = A2MP_STATUS_SUCCESS; | ||
298 | |||
299 | hdev = hci_dev_get(req->local_id); | ||
300 | if (!hdev) { | ||
301 | rsp.status = A2MP_STATUS_INVALID_CTRL_ID; | ||
302 | goto send_rsp; | ||
303 | } | ||
304 | |||
305 | /* TODO Disconnect Phys Link here */ | ||
306 | |||
307 | hci_dev_put(hdev); | ||
308 | |||
309 | send_rsp: | ||
310 | a2mp_send(mgr, A2MP_DISCONNPHYSLINK_RSP, hdr->ident, sizeof(rsp), &rsp); | ||
311 | |||
312 | skb_pull(skb, sizeof(*req)); | ||
313 | return 0; | ||
314 | } | ||
315 | |||
283 | /* Handle A2MP signalling */ | 316 | /* Handle A2MP signalling */ |
284 | static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb) | 317 | static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb) |
285 | { | 318 | { |
@@ -330,6 +363,9 @@ static int a2mp_chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb) | |||
330 | break; | 363 | break; |
331 | 364 | ||
332 | case A2MP_DISCONNPHYSLINK_REQ: | 365 | case A2MP_DISCONNPHYSLINK_REQ: |
366 | err = a2mp_discphyslink_req(mgr, skb, hdr); | ||
367 | break; | ||
368 | |||
333 | case A2MP_CHANGE_RSP: | 369 | case A2MP_CHANGE_RSP: |
334 | case A2MP_DISCOVER_RSP: | 370 | case A2MP_DISCOVER_RSP: |
335 | case A2MP_GETINFO_RSP: | 371 | case A2MP_GETINFO_RSP: |