This will call connect callback when connected or failed to connect. --- emulator/bthost.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/emulator/bthost.c b/emulator/bthost.c index 96200a0..9b342ce 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -1452,6 +1452,15 @@ static void rfcomm_ua_recv(struct bthost *bthost, struct btconn *conn, rfcomm_fcs(buf); send_acl(bthost, conn->handle, l2conn->dcid, buf, sizeof(buf)); + } else if (bthost->rfcomm_conn_data && + bthost->rfcomm_conn_data->channel == channel) { + if (bthost->rfcomm_conn_data->cb) + bthost->rfcomm_conn_data->cb(conn->handle, + l2conn->scid, channel, + bthost->rfcomm_conn_data->user_data, + true); + free(bthost->rfcomm_conn_data); + bthost->rfcomm_conn_data = NULL; } } @@ -1459,6 +1468,19 @@ static void rfcomm_dm_recv(struct bthost *bthost, struct btconn *conn, struct l2conn *l2conn, const void *data, uint16_t len) { + const struct rfcomm_cmd *hdr = data; + uint8_t channel = RFCOMM_GET_CHANNEL(hdr->address); + + if (bthost->rfcomm_conn_data && + bthost->rfcomm_conn_data->channel == channel) { + if (bthost->rfcomm_conn_data->cb) + bthost->rfcomm_conn_data->cb(conn->handle, + l2conn->scid, channel, + bthost->rfcomm_conn_data->user_data, + false); + free(bthost->rfcomm_conn_data); + bthost->rfcomm_conn_data = NULL; + } } static void rfcomm_msc_recv(struct bthost *bthost, struct btconn *conn, -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html