diff --git a/emulator/bthost.c b/emulator/bthost.c
index 6c616e8..5e83e14 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
uint8_t ident, const void *data, uint16_t len)
{
const struct bt_l2cap_pdu_conn_rsp *rsp = data;
+ struct bt_l2cap_pdu_config_req req;
struct l2conn *l2conn;
if (len < sizeof(*rsp))
else
return false;
- if (le16_to_cpu(rsp->result) == 0x0001) {
- struct bt_l2cap_pdu_config_req req;
+ if (rsp->result)
+ return true;
- memset(&req, 0, sizeof(req));
- req.dcid = rsp->dcid;
+ memset(&req, 0, sizeof(req));
+ req.dcid = rsp->dcid;
- l2cap_sig_send(bthost, conn, BT_L2CAP_PDU_CONFIG_REQ, 0,
+ l2cap_sig_send(bthost, conn, BT_L2CAP_PDU_CONFIG_REQ, 0,
&req, sizeof(req));
- } else if (l2conn->psm == 0x0003 && !rsp->result && !rsp->status &&
- bthost->rfcomm_conn_data) {
- rfcomm_sabm_send(bthost, conn, l2conn, 1, 0);
- }
return true;
}
uint8_t ident, const void *data, uint16_t len)
{
const struct bt_l2cap_pdu_config_rsp *rsp = data;
+ struct l2conn *l2conn;
if (len < sizeof(*rsp))
return false;
+ l2conn = btconn_find_l2cap_conn_by_scid(conn, rsp->scid);
+ if (!l2conn)
+ return false;
+
+ if (l2conn->psm == 0x0003 && !rsp->result && bthost->rfcomm_conn_data)
+ rfcomm_sabm_send(bthost, conn, l2conn, 1, 0);
+
return true;
}