diff --git a/emulator/bthost.c b/emulator/bthost.c
index 32676e1..f29bda0 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
}
}
+static bool l2cap_rsp(uint8_t code)
+{
+ switch (code) {
+ case BT_L2CAP_PDU_CMD_REJECT:
+ case BT_L2CAP_PDU_CONN_RSP:
+ case BT_L2CAP_PDU_CONFIG_RSP:
+ case BT_L2CAP_PDU_INFO_RSP:
+ return true;
+ }
+
+ return false;
+}
+
static void l2cap_sig(struct bthost *bthost, struct btconn *conn,
const void *data, uint16_t len)
{
ret = false;
}
- handle_pending_l2reqs(bthost, conn, hdr->ident, hdr->code,
+ if (l2cap_rsp(hdr->code))
+ handle_pending_l2reqs(bthost, conn, hdr->ident, hdr->code,
data + sizeof(*hdr), hdr_len);
if (ret)
return true;
}
+static bool l2cap_le_rsp(uint8_t code)
+{
+ switch (code) {
+ case BT_L2CAP_PDU_CMD_REJECT:
+ case BT_L2CAP_PDU_CONN_PARAM_RSP:
+ case BT_L2CAP_PDU_LE_CONN_RSP:
+ case BT_L2CAP_PDU_ECRED_CONN_RSP:
+ return true;
+ }
+
+ return false;
+}
+
static void l2cap_le_sig(struct bthost *bthost, struct btconn *conn,
const void *data, uint16_t len)
{
ret = false;
}
- handle_pending_l2reqs(bthost, conn, hdr->ident, hdr->code,
+ if (l2cap_le_rsp(hdr->code))
+ handle_pending_l2reqs(bthost, conn, hdr->ident, hdr->code,
data + sizeof(*hdr), hdr_len);
if (ret)