From dfca2fff13f6c7d583e82ca3c3c5541ce0ed4d37 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Mon, 27 May 2013 15:26:56 +0300 Subject: [PATCH] emulator: Add L2CAP Disconnect Request handler to bthost --- emulator/bthost.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/emulator/bthost.c b/emulator/bthost.c index c9ae91c20..5d713b95b 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -459,6 +459,25 @@ static bool l2cap_config_rsp(struct bthost *bthost, uint16_t handle, return true; } +static bool l2cap_disconn_req(struct bthost *bthost, uint16_t handle, + uint8_t ident, const void *data, uint16_t len) +{ + const struct bt_l2cap_pdu_disconn_req *req = data; + struct bt_l2cap_pdu_disconn_rsp rsp; + + if (len < sizeof(*req)) + return false; + + memset(&rsp, 0, sizeof(rsp)); + rsp.dcid = req->dcid; + rsp.scid = req->scid; + + send_l2cap_sig(bthost, handle, BT_L2CAP_PDU_DISCONN_RSP, ident, &rsp, + sizeof(rsp)); + + return true; +} + static bool l2cap_info_req(struct bthost *bthost, uint16_t handle, uint8_t ident, const void *data, uint16_t len) { @@ -509,6 +528,11 @@ static void l2cap_sig(struct bthost *bthost, uint16_t handle, const void *data, data + sizeof(*hdr), hdr_len); break; + case BT_L2CAP_PDU_DISCONN_REQ: + ret = l2cap_disconn_req(bthost, handle, hdr->ident, + data + sizeof(*hdr), hdr_len); + break; + case BT_L2CAP_PDU_INFO_REQ: ret = l2cap_info_req(bthost, handle, hdr->ident, data + sizeof(*hdr), hdr_len); -- 2.47.3