Diff between 58ca55c669bac48db94614da9de4bad94351c2f1 and dfca2fff13f6c7d583e82ca3c3c5541ce0ed4d37

Changed Files

File Additions Deletions Status
emulator/bthost.c +24 -0 modified

Full Patch

diff --git a/emulator/bthost.c b/emulator/bthost.c
index c9ae91c..5d713b9 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);